<?php

//防止恶意调用
if (!defined('IN_MOD'))
{
    die('Hacking attempt');
}

// 自定义模块，自定义区块，自定义配置
// 自定义栏目，自定义插件，自定义扩展，自定义单页，自定义分类

// 数据列表插入参数
// 使用方法：insertmoduleparameter($article_id);
function insertmoduleparameter($dataid=0, $topid = 0, $columnid = 0, $tablename = "", $dataidname = "", $module = "article")
{
	global $lang;
	global $_MGPC_POST,$_MGPC_GET,$_MGPC_REQ,$_MGPC_COOKIE,$_MGPC_SESSION,$configlang,$configinfo,$configblock,$configcommon,$configmember,$configbase,$configsystem,$configindex,$configother;
	global $cjdb,$parameter_out,$_FILES,$moduleupload,$moduleimage,$getdataparameter,$getmoduleconfig;
	global $supplier_id;
	
	// 模块参数字段数组配置 DATE：2020-4-9 START
	$getdataparameter['parameter'] = $getdataparameter['parameter'] ? $getdataparameter['parameter'] : moduleaqvarval('parameter','array');
	$getdataparameter['parameter_list'] = $getdataparameter['parameter_list'] ? $getdataparameter['parameter_list'] : moduleaqvarval('parameter_list','array');
	$getdataparameter['parameter_json'] = $getdataparameter['parameter_json'] ? $getdataparameter['parameter_json'] : moduleaqvarval('parameter_json','array');
	$getdataparameter['parameter_default'] = $getdataparameter['parameter_default'] ? $getdataparameter['parameter_default'] : moduleaqvarval('parameter_default','array');
	$getdataparameter['parameter_exp'] = $getdataparameter['parameter_exp'] ? $getdataparameter['parameter_exp'] : moduleaqvarval('parameter_exp','array');
	$getdataparameter['parameter_expplist'] = $getdataparameter['parameter_expplist'] ? $getdataparameter['parameter_expplist'] : moduleaqvarval('parameter_expplist','array');
	// 模块参数字段数组配置 DATE：2020-4-9 END
	
	// 模块信息配置 DATE：2020-4-9 START
	$topmodule = $module;// 当前主模块
	$topid = !empty($topid) ? $topid : $configinfo['moduleid'];// 当前模块ID
	$topmoduleid = $topid;// 当前主模块ID
	$columnid = !empty($columnid) ? $columnid : $configinfo['columnid'];// 当前栏目ID
	$moduletopid = $configinfo['moduletopid'] ? $configinfo['moduletopid'] : 0;// 当前模块顶部ID
	$outmodule = $module=="article" && $topmoduleid != $configinfo['moduleid'] ? 1 : 0;
	$outtopid = !empty($getmoduleconfig['outtopid']) ? $getmoduleconfig['outtopid'] : ($outmodule == 1 ? $topid : 0);// 外部配置栏目ID
	$class2 = !empty($getmoduleconfig['class2']) ? $getmoduleconfig['class2'] : $configinfo['moduleclass']['class2'][$configinfo['cat_id']];
	$class2 = $class2 ? $class2 : 0;
	$class3 = !empty($getmoduleconfig['class3']) ? $getmoduleconfig['class3'] : $configinfo['moduleclass']['class3'][$configinfo['cat_id']];
	$class3 = $class3 ? $class3 : 0;
	if($topmodule=="article")
	{
		$topmoduleinfo = columninfo($configinfo['ecs_article_cat'],$topmoduleid,$configinfo['cat_id']);
		$moduletopname = $topmoduleinfo['module_name'] ? $topmoduleinfo['module_name'] : getmodulename($topmoduleid);
	}
	// 模块信息配置 DATE：2020-4-9 END
	
	$result = array('error' => 0, 'message' => '添加模块参数成功！');
	
	// 加载默认模块表
	$tablename = !empty($tablename) ? $tablename : $configinfo['ecs_article'];
	if(ifstr($tablename, $configinfo['ecs_article']) == 1)
	{
		$dataidname = !empty($dataidname) ? $dataidname : $configinfo['article_id'];
	}
	// 新增自定义模块独立表配置 DATE:2020-3-27 START
	if($topmodule=="article")
	{
		$moduletable = getmoduletable($topmoduleid);
		$topmodule_defaultmoduletable = gettopmodule("default","moduletable");
		if($moduletable != $topmodule_defaultmoduletable["tablename"])
		{
			$tablename = $moduletable;
		}
	}
	// 新增自定义模块独立表配置 DATE:2020-3-27 END
	
	// 新增重组模块参数表
	if($topmodule=="article")
	{
		$table_modulepara_para_list = "modulepara_para_list";
		$table_modulepara_para_lists = "modulepara_para_lists";
		$module=$module.$topmoduleid;
		// 新增自定义模块独立表配置 DATE:2020-3-27 START
		$moduleplist = getmoduleplist($topmoduleid);
		if($moduleplist != "article")
		{
			$table_modulepara_para_list = "modulepara_para_list_".$moduleplist;	
			$table_modulepara_para_lists = "modulepara_para_lists_".$moduleplist;	
		}
		// 新增自定义模块独立表配置 DATE:2020-3-27 END
	}else{
		$table_modulepara_para_list = "modulepara_para_list_".$module;	
		$table_modulepara_para_lists = "modulepara_para_lists_".$module;	
	}
	
	// 新增模块多级栏目参数配置 DATE:2020-4-28 START
	$topid = gettopid($topid,"default",$outmodule,$outtopid);
	$topmodule_module = gettopmodule($topid);
	// 新增模块多级栏目参数配置 DATE:2020-4-28 END
	
	// 添加数据时获取指定商家ID
	if($configinfo['supplierok'] == 1)
	{
		if($supplier_id)
		{
			$sql = "UPDATE ".$tablename." SET supplier_id = '$supplier_id' WHERE $dataidname='".$dataid."'";
			$cjdb->query($sql);
		}
	}
	
	// 默认文章模块时
	if($topmodule=="article")
	{
		// 设置文章模块ID功能【更改放于模块条件modulewhere之前，当前数据必需存在或设置模块ID】
		if($configinfo['moduleidok'] == 1)
		{
			$sql = "UPDATE ".$tablename." SET module = '$topmoduleid' WHERE $dataidname='".$dataid."'";
			$cjdb->query($sql);
		}
	}
	
	// 新增设置模块参数动态字段不可添加修改的字段权限 DATE:2020-12-17 START
	// 前台模块参数配置时，不限制后台非法字段修改设置，后台可修改任何字段，无限制
	if($configinfo['modulepara'] != "admin" || ($configinfo['modulepara'] == "admin" && empty($topmodule_module['sitepara']) && empty($topmodule_module['xcxsitepara'])))
	{
		$parafieldpriarr = $topmodule_module['parafieldpri'];
		foreach($parafieldpriarr as $paragroup=>$parafield)
		{
			foreach($parafield as $key=>$field)
			{
				if($getdataparameter[$paragroup][$field])
				{
					unset($getdataparameter[$paragroup][$field]);
					return array('error' => 1, 'message' => "您当前的修改存在非法字段！".$field."|");exit;
				}
			}
		}
	}
	// 新增设置模块参数动态字段不可添加修改的字段权限 DATE:2020-12-17 END
	
	// 当前数据表
	$sql = "SELECT * FROM $tablename WHERE $dataidname=".$dataid;
	$defaultdata = $cjdb->getRow($sql);	
	
	// 商家操作数据权限（只允许操作自己的数据，限制非法操作其它商家的数据）
	// 支持所有模块商家权限判断
	if($supplier_id)
	{
		if($defaultdata['supplier_id'] != $supplier_id)
		{
			return array('error' => 1, 'message' => "非法操作！商家只能操作自己的数据！");exit;	
		}
	}
	
	// 会员操作数据权限（只允许操作自己的数据，限制非法操作其它会员的数据）
	// 支持所有模块会员权限判断
	if($configinfo['modulepara'] == 'pc' || $configinfo['modulepara'] == 'mobile' || $configinfo['modulepara'] == 'xcx')
	{
		if($configinfo['expmember_uid'] && $defaultdata['user_id'] != $configinfo['expmember_uid'])
		{
			return array('error' => 1, 'message' => "非法操作！会员只能操作自己的数据！");exit;	
		}
	}
	
	// 默认文章模块时
	if($topmodule=="article")
	{		
		// 新增栏目模块修改删除数据时限制操作当前模块条件 DATE:2020-12-17 START
		if(ifstr($tablename, $configinfo['ecs_article']) == 1)
		{
			// 模块操作数据权限（只允许操作当前模块的数据，限制非法操作其它模块的数据）
			if($defaultdata['module'] != $topmoduleid)
			{
				return array('error' => 1, 'message' => "不可操作其它模块下的数据或当前模块操作数据不存在，非法操作！");exit;	
			}
			
			// 模块操作数据where条件权限
			$modulewhere = getmodulewhere($topmoduleid);
			$plistmodulewhere = getmodulewhere($module);
		}
		// 新增栏目模块修改删除数据时限制操作当前模块条件 DATE:2020-12-17 END
	
		// 关联ID
		$attrid = moduleaqvarval('attrid','intval');
		
		// 新增生成缩略图
		if($configinfo['imgsrcok'] == 1)
		{
			// 新增模块其它配置多级栏目参数配置 DATE:2020-5-30 START
			$scthumb_topid = gettopid($topmoduleid,"scthumb",$outmodule,$outtopid);
			// 新增模块其它配置多级栏目参数配置 DATE:2020-5-30 END
			$topmodule_srcconfiginfo = gettopmodule($scthumb_topid,"scthumb");
			$srcconfiginfo = $topmodule_srcconfiginfo;
			if(is_array($srcconfiginfo))
			{
				$sql="select * from $tablename where $dataidname = '$dataid'";
				$getdata=$cjdb->getRow($sql);
				$mainimg = $getdata[$srcconfiginfo['mainimg']];
				if($mainimg)
				{
					// portal/20200212/b6e8030a0384c800f57c805a83bc44e0.jpg
					$mainimgarr = getstrtoarr('/',$mainimg);// 拆分原始图链接
					$mainimgname = $mainimgarr[count($mainimgarr)-1];// 原始图名
					$mainimgurl = delthstr($mainimg,$mainimgname,"")."thumb/";//原图路径
					$srcdir = WEBSITE_PATH.$srcconfiginfo['srcurl'].$mainimg;// 原图目录
					$savedir = WEBSITE_PATH.$srcconfiginfo['srcurl'].$mainimgurl;// 保存目录
					mkFolder($savedir);// 创建目录
					
					$srcimgthumbname = $moduleimage->thumb($srcdir,$savedir,$srcconfiginfo['thumb_width'],$srcconfiginfo['thumb_height'],$srcconfiginfo['thumb_type'],$srcconfiginfo['thumb_qz']);// 留白	
					if($srcimgthumbname)
					{
						$srcimgthumburl = $mainimgurl.$srcimgthumbname;	
						$sql = "UPDATE ".$tablename." SET img_thumb = '$srcimgthumburl' WHERE $dataidname='".$dataid."' $modulewhere";
						$cjdb->query($sql);
					}else{
						return array('error' => 1, 'message' => "生成缩略图失败！请检查是否存在上传目录和原始图片是否存在！");exit;
					}
					$srcimgbigname = $moduleimage->thumb($srcdir,$savedir,$srcconfiginfo['big_width'],$srcconfiginfo['big_height'],$srcconfiginfo['big_type'],$srcconfiginfo['big_qz']);// 留白	
					if($srcimgbigname)
					{
						$srcimgbigurl = $mainimgurl.$srcimgbigname;	
						$sql = "UPDATE ".$tablename." SET img_big = '$srcimgbigurl' WHERE $dataidname='".$dataid."' $modulewhere";
						$cjdb->query($sql);
					}else{
						return array('error' => 1, 'message' => "生成大图失败！请检查是否存在上传目录和原始图片是否存在！");exit;
					}
				}
			}
		}
		
		// 设置文章栏目ID功能 支持三级栏目
		if($configinfo['classok'] == 1)
		{
			if(isset($class2))$getdataparameter['parameter_default']['class2'] = $class2;	
			if(isset($class3))$getdataparameter['parameter_default']['class3'] = $class3;	
		}
		
		// 新增区别系统与普通文章类型 DATE：2020-1-2 START
		$systemok = 0;
		if($configinfo['systemok'] == 1)
		{
			$zdyarr = explode(",", $configinfo['zdyid']);
			if(in_array($moduletopid,$zdyarr))
			{
				$systemok = 1;
				$getdataparameter['parameter_default']['systemok'] = 1;
				
				// 新增网站配置类型
				$getsystemok = moduleaqvarval('systemok','intval');
				if(!empty($getsystemok))
				{
					$systemok = $getsystemok;
					$getdataparameter['parameter_default']['systemok'] = $getsystemok;
				}
				
				// 定义系统模块名
				$moduletopname = "system";
			}
		}
		// 新增区别系统与普通文章类型 DATE：2020-1-2 END
		
		// 新增通过内容提取当前描述修改
		if($configinfo['descok'] == 1)
		{
			$sql="select * from $tablename where $dataidname = '$dataid'";
			$getdata=$cjdb->getRow($sql);
			if(!empty($getdata[$configinfo['content']]))
			{
				$getdesc = seodetaildescription(htmlspecialchars_decode($getdata[$configinfo['content']]),120);
				if($getdesc && empty($getdata[$configinfo['description']]))
				{
					$sql = "UPDATE ".$tablename." SET ".$configinfo['description']." = '$getdesc' WHERE $dataidname='".$dataid."' $modulewhere";
					$cjdb->query($sql);
				}
			}
		}
	}
	
	// 默认文章模块时
	if($topmodule=="article")
	{
		// 新增加载内容代码配置程序
		$moduledir = $supplier_id || $configinfo['modulepara'] != "admin" ? "configmodule" : "configmodulepara";
		if(iffile(MODULEPARA_PATH.'/configmodule/'.$moduledir.'/module/article/configinsert.php') == 1)
		{
			include(MODULEPARA_PATH.'/configmodule/'.$moduledir.'/module/article/configinsert.php');
		}
		if($configinfo['tplok'] == 1)
		{
			if(iffile($configinfo['tplurl'].'/configmodule/'.$moduledir.'/module/article/configinsert.php') == 1)
			{
				include($configinfo['tplurl'].'/configmodule/'.$moduledir.'/module/article/configinsert.php');
			}
		}
	}else{
		// 新增加载内容代码配置程序
		if(iffile(MODULEPARA_PATH.'/configmodule/configmodulepara/module/'.$topmodule.'/configinsert.php') == 1)
		{
			include(MODULEPARA_PATH.'/configmodule/configmodulepara/module/'.$topmodule.'/configinsert.php');
		}
		if($configinfo['tplok'] == 1)
		{
			if(iffile($configinfo['tplurl'].'/configmodule/configmodulepara/module/'.$topmodule.'/configinsert.php') == 1)
			{
				include($configinfo['tplurl'].'/configmodule/configmodulepara/module/'.$topmodule.'/configinsert.php');
			}
		}	
	}
	
	if(is_array($getdataparameter['parameter']))
	{
		// 获取当前模块上传配置信息
		if($topmodule == "article")
		{
			$upconfigmodule	= "article_".$moduletopname;
		}else{
			$upconfigmodule = $module;	
		}
		$topmodule_upconfiginfo = gettopmodule($upconfigmodule,"uploadconfig");
		$upconfiginfo = $topmodule_upconfiginfo;
		
		/*------------------------------------获取上传图片*/
		//设置属性(上传的位置， 大小， 类型， 名是是否要随机生成)
		$moduleupload -> set("path", $configinfo['uploaddir'].$upconfiginfo['filesaveurl'].date('Ym',time())."/");
		$moduleupload -> set("maxsize", $configinfo['uploadsize']);
		$moduleupload -> set("allowtype", $configinfo['uploadtype']);
		$moduleupload -> set("israndname", $configinfo['uploadname']);
		for($i = 1; $i < count(10); $i++)
		{ 
			/* 上传图片数据存在时 */
			if(isset($_FILES['inctype_img'.$i]))
			{
				if($_FILES['inctype_img'.$i])
				{
					//使用对象中的upload方法， 就可以上传文件， 方法需要传一个上传表单的名子 pic, 如果成功返回true, 失败返回false
					if($moduleupload -> upload('inctype_img'.$i)) {
						//获取上传后文件名子
						$inctype_img = $upconfiginfo['filesaveurl'].date('Ym',time())."/".$moduleupload->getFileName();
						$sql = "INSERT INTO $table_modulepara_para_list (listid, attrid, paraid, info, type, classid, module, systemok, lang) ". "VALUES ('".$dataid."', '".$attrid."', 'inctype_img".$i."', '".$inctype_img."', '5', '".$columnid."', '$module', '$systemok', '".$configinfo['lang']."')";
						$cjdb->query($sql);
				 
					}
				}
			}
		}
		/*------------------------------------获取上传图片*/
		foreach($getdataparameter['parameter'] as $key=>$val)
		{				
			// 默认类型
			$ptype = 0;
			// 图片类型
			if(strpos($key,"imgtype_") !== false)
			{
				$ptype = 1;
				$key = delthstr($key,"imgtype_","");// 删除参数前缀
			}
			// 文件类型
			if(strpos($key,"filetype_") !== false)
			{
				$ptype = 2;
				$key = delthstr($key,"filetype_","");// 删除参数前缀
			}
			// 数组类型
			if(strpos($key,"arrtype_") !== false)
			{
				$ptype = 3;
				$val = getarrtostr(",",$val);
				$key = delthstr($key,"arrtype_","");// 删除参数前缀
			}
			// JSON类型
			if(strpos($key,"jsontype_") !== false)
			{
				$ptype = 4;
				$val = moduledatajoin(getjsonstr($val));
				$key = delthstr($key,"jsontype_","");// 删除参数前缀
			}
			// 日期类型
			if(strpos($key,"datetype_") !== false)
			{
				$ptype = 5;
				$val = strtotime($val);
				$key = delthstr($key,"datetype_","");// 删除参数前缀
			}
			// 链接类型
			if(strpos($key,"linktype_") !== false)
			{
				$ptype = 6;
				$key = delthstr($key,"linktype_","");// 删除参数前缀
			}
			// 默认调用类型
			if(strpos($key,"inctype_") !== false)
			{
				$ptype = 11;
				$key = delthstr($key,"inctype_","");// 删除参数前缀
			}
			// 图片文件调用类型
			if(strpos($key,"incfiletype_") !== false)
			{
				$ptype = 12;
				$key = delthstr($key,"incfiletype_","");// 删除参数前缀
			}
			// 订购参数类型
			if(strpos($key,"shoptype_") !== false)
			{
				$ptype = 13;
				$key = delthstr($key,"shoptype_","");// 删除参数前缀
			}
			
			// 推荐参数
			$precok = 0;
			if(strpos($key,"recpara_") !== false)
			{
				$precok = 1;
				$key = delthstr($key,"recpara_","");// 删除参数前缀
			}
			
			// 关联自定义参数
			$attrparaid = 0;
			if(strpos($key,"attrpara_") !== false)
			{				
				$key = delthstr($key,"attrpara_","");// 删除参数前缀
				$keyarr = getstrtoarr("|",$key);
				$key = $keyarr[0];
				$attrparaid = $keyarr[1];
			}
			
			// 参数字段类型设置-------------------------------------------------------------START
			
			// 小型整数参数
			$tintparaVal = 0;
			if(strpos($key,"tintpara_") !== false)
			{
				$key = delthstr($key,"tintpara_","");// 删除参数前缀
				$tintparaVal = $val;
				$val = "";
			}
			
			// 整数参数
			$intparaVal = 0;
			if(strpos($key,"intpara_") !== false)
			{
				$key = delthstr($key,"intpara_","");// 删除参数前缀
				$intparaVal = $val;
				$val = "";
			}
			
			// 小数参数
			$decparaVal = 0;
			if(strpos($key,"decpara_") !== false)
			{
				$key = delthstr($key,"decpara_","");// 删除参数前缀
				$decparaVal = $val;
				$val = "";
			}
			
			// 文本参数
			$textparaVal = "";
			if(strpos($key,"textpara_") !== false)
			{
				$key = delthstr($key,"textpara_","");// 删除参数前缀
				$textparaVal = $val;
				$val = "";
			}
			
			// 参数字段类型设置-------------------------------------------------------------END
			
			$sql = "INSERT INTO $table_modulepara_para_list (listid, attrid, attrparaid, paraid, info, tintpara, intpara, decpara, textpara, type, recok, classid, module, systemok, lang) ". "VALUES ('".$dataid."', '".$attrid."', '".$attrparaid."', '".$key."', '".$val."', '".$tintparaVal."', '".$intparaVal."', '".$decparaVal."', '".$textparaVal."', '$ptype', '$precok', '".$columnid."', '$module', '$systemok', '".$configinfo['lang']."')";
   			$cjdb->query($sql);
		}
	}
	if(is_array($getdataparameter['parameter_list']))
	{
		foreach($getdataparameter['parameter_list'] as $klist=>$vlist)
		{
			$parameter_list_key="";$parameter_list_val="";
			foreach($vlist as $key=>$val)
			{
				$aqkey = moduleaqvarval($key, "string", "data");
				$parameter_list_key .= ",`$aqkey`";
				$parameter_list_val .= ",'$val'";
			}
			$parameter_list_key = substr($parameter_list_key, 1);
			$parameter_list_val = substr($parameter_list_val, 1);
			$sql = "INSERT INTO $table_modulepara_para_lists (".$parameter_list_key.",`listid`,`attrid`,`keyid`,`module`,`systemok`,`lang`) ". "VALUES (".$parameter_list_val.",'$dataid','$attrid','$klist', '$module', '$systemok', '".$configinfo['lang']."')";
			$cjdb->query($sql);
		}
	}
	if(is_array($getdataparameter['parameter_json']))
	{
		$parameter_json = moduledatajoin(getjsonstr($getdataparameter['parameter_json']));
		$sql = "UPDATE $tablename SET `parameter` = '$parameter_json'". " WHERE $dataidname = '".$dataid."' $modulewhere";
		$cjdb->query($sql);
	}
	if(is_array($getdataparameter['parameter_default']))
	{
		// 删除默认表模块参数中不可修改操作的系统字段
		unset($getdataparameter['parameter_default']['module']);// module字段
		unset($getdataparameter['parameter_default']['class2']);// class2字段
		unset($getdataparameter['parameter_default']['class3']);// class3字段
		if($configinfo['supplierok'] == 1)
		{
			unset($getdataparameter['parameter_default']['supplier_id']);// 商家ID字段
			unset($getdataparameter['parameter_default']['supplier_status']);// 商家状态字段
		}
		// 配置的不可修改的系统字段
		$deffieldpri = getstrtoarr(",", $configinfo['deffieldpri']);
		foreach($deffieldpri as $key=>$field)
		{
			if($getdataparameter['parameter_default'][$field])
			{
				unset($getdataparameter['parameter_default'][$field]);	
				return array('error' => 1, 'message' => "您当前的修改存在非法字段！".$field."|");exit;
			}
		}
		foreach($getdataparameter['parameter_default'] as $key=>$val)
		{
			if($val)
			{
				// 默认类型
				$datatype = 0;
				if(ifstr($key,"type_") == 1)
				{
					// 图片类型
					if(strpos($key,"imgtype_") !== false)
					{
						$datatype = 1;
					}
					// 文件类型
					if(strpos($key,"filetype_") !== false)
					{
						$datatype = 2;
					}
					// 数组类型
					if(strpos($key,"arrtype_") !== false)
					{
						$datatype = 3;
						$val = getarrtostr(",",$val);
					}
					// JSON类型
					if(strpos($key,"jsontype_") !== false)
					{
						$datatype = 4;
						$val = moduledatajoin(getjsonstr($val));
					}
					// 日期类型
					if(strpos($key,"datetype_") !== false)
					{
						$datatype = 5;
						$val = strtotime($val);
					}
				}
				
				$aqkey = moduleaqvarval($key, "string", "data");
				$sql = "UPDATE $tablename SET `$aqkey` = '$val'". " WHERE $dataidname = '".$dataid."' $modulewhere";
				$cjdb->query($sql);
			}
		}
	}
	
	// 默认文章模块时
	if($topmodule=="article")
	{
		// 当前栏目配置信息
		// 新增模块其它配置多级栏目参数配置 DATE:2020-5-30 START
		$expmodule_topid = gettopid($topmoduleid,"expmodule",$outmodule,$outtopid);
		// 新增模块其它配置多级栏目参数配置 DATE:2020-5-30 END
		$topmodule_expmodule = gettopmodule($expmodule_topid,"expmodule");
	
		// 关联表修改
		if(moduleaqvarval($getdataparameter['parameter_default']['attrset'],'string','data') && is_array($topmodule_expmodule['parameter_attr_tablename']))
		{
			$attrset = explode(',',moduleaqvarval($getdataparameter['parameter_default']['attrset'],'string','data'));
			foreach($topmodule_expmodule['parameter_attr_tablename'] as $attrkey=>$attrval)
			{
				$sql = "UPDATE ".$topmodule_expmodule['parameter_attr_tablename'][$attrkey]." SET attrid='".$dataid."' WHERE ".$topmodule_expmodule['parameter_attr_where'][$attrkey]."='".$attrset[$attrkey]."'";
				$cjdb->query($sql);
			}
		}
	
		// 自定义扩展
		if(is_array($getdataparameter['parameter_exp']))
		{
			if($topmodule_expmodule['parameter_exp_tablename'] && $topmodule_expmodule['parameter_exp_title'])
			{			
				$attrtitle = explode('|',$topmodule_expmodule['parameter_exp_title']);
				if(ifstr($attrtitle[1],"-"))$attrtitle[1] = getstrtoarr('-',$attrtitle[1]);
				$attrcate = explode('|',$topmodule_expmodule['parameter_exp_category']);
				if(ifstr($attrcate[1],"-"))$attrcate[1] = getstrtoarr('-',$attrcate[1]);
				
				foreach($getdataparameter['parameter_exp'] as $key=>$val)
				{
					$aqkey = moduleaqvarval($key, "string", "data");
					$parameter_exp_key .= ",`$aqkey`";
					$parameter_exp_val .= ",'$val'";
				}
				$parameter_exp_key = substr($parameter_exp_key, 1);
				$parameter_exp_val = substr($parameter_exp_val, 1);
				$sql = "INSERT INTO ".$topmodule_expmodule['parameter_exp_tablename']." (".$parameter_exp_key.",`attrid`,`".$attrtitle[0]."`,`".$attrcate[0]."`) ". "VALUES (".$parameter_exp_val.",'$dataid','".moduleaqvarval($attrtitle[1],'string')."','".moduleaqvarval($attrcate[1],'string')."')";
				$cjdb->query($sql);
				
				$exp_insert_id = $cjdb->getInsertid();
			}
		}
		if(moduleaqvarval('attrid','intval') && $topmodule_expmodule['parameter_exp_tablename'])
		{
			$exp_tablename = $topmodule_expmodule['parameter_exp_tablename'];
			$exp_id = $topmodule_expmodule['parameter_exp_id'];
			$sql = "SELECT $exp_id FROM $exp_tablename WHERE attrid = '".moduleaqvarval('attrid','intval')."'";
			$attrinfo = $cjdb->getRow($sql);
			$exp_insert_id = $attrinfo[$exp_id];
		}
		if($exp_insert_id && is_array($getdataparameter['parameter_expplist']))
		{
			foreach($getdataparameter['parameter_expplist'] as $key=>$val)
			{	
				foreach($val as $key2=>$val2)
				{
					$aqkey2 = moduleaqvarval($key2, "string", "data");
					$parameter_expplist_key .= ",`$aqkey2`";
					$parameter_expplist_val .= ",'$val2'";
				}
				$parameter_expplist_key = substr($parameter_expplist_key, 1);
				$parameter_expplist_val = substr($parameter_expplist_val, 1);
				$sql = "INSERT INTO ".$topmodule_expmodule['parameter_expplist_tablename']." (attrid, listid, keyid, ".$parameter_expplist_key.") ". "VALUES ('".$dataid."', '".$exp_insert_id."', '".$key."', ".$parameter_expplist_val.")";
				$cjdb->query($sql);
			}
		}
		if($exp_insert_id && !empty($topmodule_expmodule['parameter_expptable_tablename']))
		{
			$expptable = explode(',',$topmodule_expmodule['parameter_expptable_tablename']);
			$ti = 0;
			foreach($expptable as $kt=>$ptable)
			{
				$ti++;
				$parameter_expptable = 'parameter_expptable_'.$ti;
				if($topmodule_expmodule['parameter_expptable_title'])$parameter_expptable = 'parameter_expptable_exp';
				if(moduleaqvarval($parameter_expptable,'array'))$getdataparameter[$parameter_expptable] = moduleaqvarval($parameter_expptable,'array');
				$parameter_expptable_key = "";
				$parameter_expptable_val = "";
				if(is_array($getdataparameter[$parameter_expptable]))
				{	
					$expattrtitle = explode('|',$topmodule_expmodule['parameter_expptable_title']);
					if(ifstr($expattrtitle[1],"-"))$expattrtitle[1] = getstrtoarr('-',$expattrtitle[1]);
					$expattrcate = explode('|',$topmodule_expmodule['parameter_expptable_category']);
					if(ifstr($expattrcate[1],"-"))$expattrcate[1] = getstrtoarr('-',$expattrcate[1]);
										
					foreach($getdataparameter[$parameter_expptable] as $key=>$val)
					{
						$aqkey = moduleaqvarval($key, "string", "data");
						$parameter_expptable_key .= ",`$aqkey`";
						$parameter_expptable_val .= ",'$val'";
					}
					$parameter_expptable_key = substr($parameter_expptable_key, 1);
					$parameter_expptable_val = substr($parameter_expptable_val, 1);
					if($topmodule_expmodule['parameter_expptable_title'] && $topmodule_expmodule['parameter_expptable_category'])
					{
						$sql = "INSERT INTO ".$ptable." (".$parameter_expptable_key.",`attrid`,`listid`,`".$expattrtitle[0]."`,`".$expattrcate[0]."`) ". "VALUES (".$parameter_expptable_val.",'$dataid','".$exp_insert_id."','".moduleaqvarval($expattrtitle[1],'string')."','".moduleaqvarval($expattrcate[1],'string')."')";
						$cjdb->query($sql);
					}else{
						$sql = "INSERT INTO ".$ptable." (".$parameter_expptable_key.",`attrid`,`listid`) ". "VALUES (".$parameter_expptable_val.",'$dataid','".$exp_insert_id."')";
						$cjdb->query($sql);	
					}
				}
			}
		}
	}
	
	return $result;
}

// 数据列表修改参数
// 使用方法：updatemoduleparameter(moduleaqvarval('id','intval'));
function updatemoduleparameter($dataid=0, $topid = 0, $columnid = 0, $tablename = "", $dataidname = "", $module = "article")
{
	global $lang;
	global $_MGPC_POST,$_MGPC_GET,$_MGPC_REQ,$_MGPC_COOKIE,$_MGPC_SESSION,$configlang,$configinfo,$configblock,$configcommon,$configmember,$configbase,$configsystem,$configindex,$configother;
	global $cjdb,$parameter_out,$_FILES,$moduleupload,$moduleimage,$getdataparameter,$getmoduleconfig;
	global $supplier_id;
	
	// 模块参数字段数组配置 DATE：2020-4-9 START	
	$getdataparameter['parameter'] = $getdataparameter['parameter'] ? $getdataparameter['parameter'] : moduleaqvarval('parameter','array');
	$getdataparameter['parameter_list'] = $getdataparameter['parameter_list'] ? $getdataparameter['parameter_list'] : moduleaqvarval('parameter_list','array');
	$getdataparameter['parameter_json'] = $getdataparameter['parameter_json'] ? $getdataparameter['parameter_json'] : moduleaqvarval('parameter_json','array');
	$getdataparameter['parameter_default'] = $getdataparameter['parameter_default'] ? $getdataparameter['parameter_default'] : moduleaqvarval('parameter_default','array');
	$getdataparameter['parameter_exp'] = $getdataparameter['parameter_exp'] ? $getdataparameter['parameter_exp'] : moduleaqvarval('parameter_exp','array');
	$getdataparameter['parameter_expplist'] = $getdataparameter['parameter_expplist'] ? $getdataparameter['parameter_expplist'] : moduleaqvarval('parameter_expplist','array');
	// 模块参数字段数组配置 DATE：2020-4-9 END
	
	// 模块信息配置 DATE：2020-4-9 START
	$topmodule = $module;// 当前主模块
	$topid = !empty($topid) ? $topid : $configinfo['moduleid'];// 当前模块ID
	$topmoduleid = $topid;// 当前主模块ID
	$columnid = !empty($columnid) ? $columnid : $configinfo['columnid'];// 当前栏目ID
	$moduletopid = $configinfo['moduletopid'] ? $configinfo['moduletopid'] : 0;// 当前模块顶部ID
	$outmodule = $module=="article" && $topmoduleid != $configinfo['moduleid'] ? 1 : 0;
	$outtopid = !empty($getmoduleconfig['outtopid']) ? $getmoduleconfig['outtopid'] : ($outmodule == 1 ? $topid : 0);// 外部配置栏目ID
	$class2 = !empty($getmoduleconfig['class2']) ? $getmoduleconfig['class2'] : $configinfo['moduleclass']['class2'][$configinfo['cat_id']];
	$class2 = $class2 ? $class2 : 0;
	$class3 = !empty($getmoduleconfig['class3']) ? $getmoduleconfig['class3'] : $configinfo['moduleclass']['class3'][$configinfo['cat_id']];
	$class3 = $class3 ? $class3 : 0;
	if($topmodule=="article")
	{
		$topmoduleinfo = columninfo($configinfo['ecs_article_cat'],$topmoduleid,$configinfo['cat_id']);
		$moduletopname = $topmoduleinfo['module_name'] ? $topmoduleinfo['module_name'] : getmodulename($topmoduleid);
	}
	// 模块信息配置 DATE：2020-4-9 END
	
	$result = array('error' => 0, 'message' => '修改模块参数成功！');
	
	// 加载默认模块表
	$tablename = !empty($tablename) ? $tablename : $configinfo['ecs_article'];
	if(ifstr($tablename, $configinfo['ecs_article']) == 1)
	{
		$dataidname = !empty($dataidname) ? $dataidname : $configinfo['article_id'];
	}
	// 新增自定义模块独立表配置 DATE:2020-3-27 START
	if($topmodule=="article")
	{
		$moduletable = getmoduletable($topmoduleid);
		$topmodule_defaultmoduletable = gettopmodule("default","moduletable");
		if($moduletable != $topmodule_defaultmoduletable["tablename"])
		{
			$tablename = $moduletable;
		}
	}
	// 新增自定义模块独立表配置 DATE:2020-3-27 END
	
	// 新增重组模块参数表
	if($topmodule=="article")
	{
		$table_modulepara_para_list = "modulepara_para_list";
		$table_modulepara_para_lists = "modulepara_para_lists";
		$module=$module.$topmoduleid;
		// 新增自定义模块独立表配置 DATE:2020-3-27 START
		$moduleplist = getmoduleplist($topmoduleid);
		if($moduleplist != "article")
		{
			$table_modulepara_para_list = "modulepara_para_list_".$moduleplist;	
			$table_modulepara_para_lists = "modulepara_para_lists_".$moduleplist;	
		}
		// 新增自定义模块独立表配置 DATE:2020-3-27 END
	}else{
		$table_modulepara_para_list = "modulepara_para_list_".$module;	
		$table_modulepara_para_lists = "modulepara_para_lists_".$module;	
	}
	
	// 新增模块多级栏目参数配置 DATE:2020-4-28 START
	$topid = gettopid($topid,"default",$outmodule,$outtopid);
	$topmodule_module = gettopmodule($topid);
	// 新增模块多级栏目参数配置 DATE:2020-4-28 END
	
	// 新增设置模块参数动态字段不可添加修改的字段权限 DATE:2020-12-17 START
	// 前台模块参数配置时，不限制后台非法字段修改设置，后台可修改任何字段，无限制
	if($configinfo['modulepara'] != "admin" || ($configinfo['modulepara'] == "admin" && empty($topmodule_module['sitepara']) && empty($topmodule_module['xcxsitepara'])))
	{
		$parafieldpriarr = $topmodule_module['parafieldpri'];
		foreach($parafieldpriarr as $paragroup=>$parafield)
		{
			foreach($parafield as $key=>$field)
			{
				if($getdataparameter[$paragroup][$field])
				{
					unset($getdataparameter[$paragroup][$field]);
					return array('error' => 1, 'message' => "您当前的修改存在非法字段！".$field."|");exit;
				}
			}
		}
	}
	// 新增设置模块参数动态字段不可添加修改的字段权限 DATE:2020-12-17 END
	
	// 当前数据表
	$sql = "SELECT * FROM $tablename WHERE $dataidname=".$dataid;
	$defaultdata = $cjdb->getRow($sql);	
	
	// 商家操作数据权限（只允许操作自己的数据，限制非法操作其它商家的数据）
	// 支持所有模块商家权限判断
	if($supplier_id)
	{
		if($defaultdata['supplier_id'] != $supplier_id)
		{
			return array('error' => 1, 'message' => "非法操作！商家只能操作自己的数据！");exit;	
		}
	}
	
	// 会员操作数据权限（只允许操作自己的数据，限制非法操作其它会员的数据）
	// 支持所有模块会员权限判断
	if($configinfo['modulepara'] == 'pc' || $configinfo['modulepara'] == 'mobile' || $configinfo['modulepara'] == 'xcx')
	{
		if($configinfo['expmember_uid'] && $defaultdata['user_id'] != $configinfo['expmember_uid'])
		{
			return array('error' => 1, 'message' => "非法操作！会员只能操作自己的数据！");exit;	
		}
	}
	
	// 默认文章模块时
	if($topmodule=="article")
	{		
		// 新增栏目模块修改删除数据时限制操作当前模块条件 DATE:2020-12-17 START
		if(ifstr($tablename, $configinfo['ecs_article']) == 1)
		{
			// 模块操作数据权限（只允许操作当前模块的数据，限制非法操作其它模块的数据）
			if($defaultdata['module'] != $topmoduleid)
			{
				return array('error' => 1, 'message' => "不可操作其它模块下的数据或当前模块操作数据不存在，非法操作！");exit;	
			}
			
			// 模块操作数据where条件权限
			$modulewhere = getmodulewhere($topmoduleid);
			$plistmodulewhere = getmodulewhere($module);
		}
		// 新增栏目模块修改删除数据时限制操作当前模块条件 DATE:2020-12-17 END
		
		// 关联ID
		$attrid = moduleaqvarval('attrid','intval');
		
		// 新增生成缩略图
		if($configinfo['imgsrcok'] == 1)
		{
			// 新增模块其它配置多级栏目参数配置 DATE:2020-5-30 START
			$scthumb_topid = gettopid($topmoduleid,"scthumb",$outmodule,$outtopid);
			// 新增模块其它配置多级栏目参数配置 DATE:2020-5-30 END
			$topmodule_srcconfiginfo = gettopmodule($scthumb_topid,"scthumb");
			$srcconfiginfo = $topmodule_srcconfiginfo;
			if(is_array($srcconfiginfo))
			{
				$sql="select * from $tablename where $dataidname = '$dataid'";
				$getdata=$cjdb->getRow($sql);
				$mainimg = $getdata[$srcconfiginfo['mainimg']];
				if($mainimg)
				{
					// portal/20200212/b6e8030a0384c800f57c805a83bc44e0.jpg
					$mainimgarr = getstrtoarr('/',$mainimg);// 拆分原始图链接
					$mainimgname = $mainimgarr[count($mainimgarr)-1];// 原始图名
					$mainimgurl = delthstr($mainimg,$mainimgname,"")."thumb/";//原图路径
					$srcdir = WEBSITE_PATH.$srcconfiginfo['srcurl'].$mainimg;// 原图目录
					$savedir = WEBSITE_PATH.$srcconfiginfo['srcurl'].$mainimgurl;// 保存目录
					mkFolder($savedir);// 创建目录
					
					$srcimgthumbname = $moduleimage->thumb($srcdir,$savedir,$srcconfiginfo['thumb_width'],$srcconfiginfo['thumb_height'],$srcconfiginfo['thumb_type'],$srcconfiginfo['thumb_qz']);// 留白	
					if($srcimgthumbname)
					{
						$srcimgthumburl = $mainimgurl.$srcimgthumbname;	
						$sql = "UPDATE ".$tablename." SET img_thumb = '$srcimgthumburl' WHERE $dataidname='".$dataid."' $modulewhere";
						$cjdb->query($sql);
					}else{
						return array('error' => 1, 'message' => "生成缩略图失败！请检查是否存在上传目录和原始图片是否存在！");exit;
					}
					$srcimgbigname = $moduleimage->thumb($srcdir,$savedir,$srcconfiginfo['big_width'],$srcconfiginfo['big_height'],$srcconfiginfo['big_type'],$srcconfiginfo['big_qz']);// 留白	
					if($srcimgbigname)
					{
						$srcimgbigurl = $mainimgurl.$srcimgbigname;	
						$sql = "UPDATE ".$tablename." SET img_big = '$srcimgbigurl' WHERE $dataidname='".$dataid."' $modulewhere";
						$cjdb->query($sql);
					}else{
						return array('error' => 1, 'message' => "生成大图失败！请检查是否存在上传目录和原始图片是否存在！");exit;
					}
				}
			}
		}
		
		// 设置文章栏目ID功能 支持三级栏目
		if($configinfo['classok'] == 1)
		{
			if(isset($class2))$getdataparameter['parameter_default']['class2'] = $class2;	
			if(isset($class3))$getdataparameter['parameter_default']['class3'] = $class3;	
		}
		
		// 新增区别系统与普通文章类型 DATE：2020-1-2 START
		$systemok = 0;
		if($configinfo['systemok'] == 1)
		{
			$zdyarr = explode(",", $configinfo['zdyid']);
			if(in_array($moduletopid,$zdyarr))
			{
				$systemok = 1;
				$getdataparameter['parameter_default']['systemok'] = 1;
				
				// 新增网站配置类型
				$getsystemok = moduleaqvarval('systemok','intval');
				if(!empty($getsystemok))
				{
					$systemok = $getsystemok;
					$getdataparameter['parameter_default']['systemok'] = $getsystemok;
				}
				
				// 定义系统模块名
				$moduletopname = "system";
			}
		}
		// 新增区别系统与普通文章类型 DATE：2020-1-2 END
		
		// 新增通过内容提取当前描述修改
		if($configinfo['descok'] == 1)
		{
			$sql="select * from $tablename where $dataidname = '$dataid'";
			$getdata=$cjdb->getRow($sql);
			if(!empty($getdata[$configinfo['content']]))
			{
				$getdesc = seodetaildescription(htmlspecialchars_decode($getdata[$configinfo['content']]),120);
				if($getdesc && empty($getdata[$configinfo['description']]))
				{
					$sql = "UPDATE ".$tablename." SET ".$configinfo['description']." = '$getdesc' WHERE $dataidname='".$dataid."' $modulewhere";
					$cjdb->query($sql);
				}
			}
		}
	}
	
	// 默认文章模块时
	if($topmodule=="article")
	{
		// 新增加载内容代码配置程序
		$moduledir = $supplier_id || $configinfo['modulepara'] != "admin" ? "configmodule" : "configmodulepara";
		if(iffile(MODULEPARA_PATH.'/configmodule/'.$moduledir.'/module/article/configupdate.php') == 1)
		{
			include(MODULEPARA_PATH.'/configmodule/'.$moduledir.'/module/article/configupdate.php');
		}
		if($configinfo['tplok'] == 1)
		{
			if(iffile($configinfo['tplurl'].'/configmodule/'.$moduledir.'/module/article/configupdate.php') == 1)
			{
				include($configinfo['tplurl'].'/configmodule/'.$moduledir.'/module/article/configupdate.php');
			}
		}
	}else{
		// 新增加载内容代码配置程序
		if(iffile(MODULEPARA_PATH.'/configmodule/configmodulepara/module/'.$topmodule.'/configupdate.php') == 1)
		{
			include(MODULEPARA_PATH.'/configmodule/configmodulepara/module/'.$topmodule.'/configupdate.php');
		}
		if($configinfo['tplok'] == 1)
		{
			if(iffile($configinfo['tplurl'].'/configmodule/configmodulepara/module/'.$topmodule.'/configupdate.php') == 1)
			{
				include($configinfo['tplurl'].'/configmodule/configmodulepara/module/'.$topmodule.'/configupdate.php');
			}
		}	
	}
	
	if(is_array($getdataparameter['parameter']))
	{
		// 获取当前模块上传配置信息
		if($topmodule == "article")
		{
			$upconfigmodule	= "article_".$moduletopname;
		}else{
			$upconfigmodule = $module;	
		}
		$topmodule_upconfiginfo = gettopmodule($upconfigmodule,"uploadconfig");
		$upconfiginfo = $topmodule_upconfiginfo;
		
		/*------------------------------------获取上传图片*/
		//设置属性(上传的位置， 大小， 类型， 名是是否要随机生成)
		$moduleupload -> set("path", $configinfo['uploaddir'].$upconfiginfo['filesaveurl'].date('Ym',time())."/");
		$moduleupload -> set("maxsize", $configinfo['uploadsize']);
		$moduleupload -> set("allowtype", $configinfo['uploadtype']);
		$moduleupload -> set("israndname", $configinfo['uploadname']);
		for($i = 1; $i <= 10; $i++)
		{
			/* 上传图片数据存在时 */
			if(isset($_FILES['inctype_img'.$i]))
			{
				if($_FILES['inctype_img'.$i])
				{
					//使用对象中的upload方法， 就可以上传文件， 方法需要传一个上传表单的名子 pic, 如果成功返回true, 失败返回false
					if($moduleupload -> upload('inctype_img'.$i)) {
						//获取上传后文件名子
						$inctype_img = $upconfiginfo['filesaveurl'].date('Ym',time())."/".$moduleupload->getFileName();
						
						/* 判断自定义的参数内容是否存在 */
						$listattrid = moduleaqvarval('listattrid','intval');
						$listattrwhere = "";
						if($listattrid)$listattrwhere = "and listattrid='".$listattrid."'";
						$wherelang = "";
						if($configinfo['lang'])$wherelang = "and lang = '".$configinfo['lang']."'";
						$sql = "SELECT paraid FROM $table_modulepara_para_list WHERE listid = '$dataid' $listattrwhere and module = '$module' $wherelang and paraid = 'inctype_img".$i."'";
						$plist = $cjdb->getRow($sql);
						if(!empty($plist))
						{
							$sql = "UPDATE $table_modulepara_para_list SET info = '".$inctype_img."', type = '3', systemok='".$systemok."'". " WHERE listid = '".$dataid."' $listattrwhere $wherelang AND paraid = 'inctype_img".$i."' $plistmodulewhere";
							$cjdb->query($sql);
							
						/* 参数内容不存在时插入内容 */
						}else{
							$sql = "INSERT INTO $table_modulepara_para_list (listid, attrid, listattrid, paraid, info, type, classid, module, systemok, lang) ". "VALUES ('".$dataid."', '".$attrid."', '".moduleaqvarval('listattrid','intval')."', 'inctype_img".$i."', '".$inctype_img."', '5', '".$columnid."', '$module', '$systemok', '".$configinfo['lang']."')";
							$cjdb->query($sql);
						}
					}
				}
			}
		}
		/*------------------------------------获取上传图片*/
		foreach($getdataparameter['parameter'] as $key=>$val)
		{
			// 默认类型
			$ptype = 0;
			// 图片类型
			if(strpos($key,"imgtype_") !== false)
			{
				$ptype = 1;
				$key = delthstr($key,"imgtype_","");// 删除参数前缀
			}
			// 文件类型
			if(strpos($key,"filetype_") !== false)
			{
				$ptype = 2;
				$key = delthstr($key,"filetype_","");// 删除参数前缀
			}
			// 数组类型
			if(strpos($key,"arrtype_") !== false)
			{
				$ptype = 3;
				$val = getarrtostr(",",$val);
				$key = delthstr($key,"arrtype_","");// 删除参数前缀
			}
			// JSON类型
			if(strpos($key,"jsontype_") !== false)
			{
				$ptype = 4;
				$val = moduledatajoin(getjsonstr($val));
				$key = delthstr($key,"jsontype_","");// 删除参数前缀
			}
			// 日期类型
			if(strpos($key,"datetype_") !== false)
			{
				$ptype = 5;
				$val = strtotime($val);
				$key = delthstr($key,"datetype_","");// 删除参数前缀
			}
			// 链接类型
			if(strpos($key,"linktype_") !== false)
			{
				$ptype = 6;
				$key = delthstr($key,"linktype_","");// 删除参数前缀
			}
			// 默认调用类型
			if(strpos($key,"inctype_") !== false)
			{
				$ptype = 11;
				$key = delthstr($key,"inctype_","");// 删除参数前缀
			}
			// 图片文件调用类型
			if(strpos($key,"incfiletype_") !== false)
			{
				$ptype = 12;
				$key = delthstr($key,"incfiletype_","");// 删除参数前缀
			}
			// 订购参数类型
			if(strpos($key,"shoptype_") !== false)
			{
				$ptype = 13;
				$key = delthstr($key,"shoptype_","");// 删除参数前缀
			}
			
			// 推荐参数
			$precok = 0;
			if(strpos($key,"recpara_") !== false)
			{
				$precok = 1;
				$key = delthstr($key,"recpara_","");// 删除参数前缀
			}
			
			// 关联自定义参数
			$attrparaid = 0;
			if(strpos($key,"attrpara_") !== false)
			{				
				$key = delthstr($key,"attrpara_","");// 删除参数前缀
				$keyarr = getstrtoarr("|",$key);
				$key = $keyarr[0];
				$attrparaid = $keyarr[1];
			}
			
			// 修改参数设置默认参数
			$setVal = "info = '".$val."'";
			
			// 参数字段类型设置-------------------------------------------------------------START
			
			// 小型整数参数
			$tintparaVal = 0;
			if(strpos($key,"tintpara_") !== false)
			{
				$key = delthstr($key,"tintpara_","");// 删除参数前缀
				$tintparaVal = $val;
				$setVal = "tintpara = '".$val."'";
				$val = "";
			}
			
			// 整数参数
			$intparaVal = 0;
			if(strpos($key,"intpara_") !== false)
			{
				$key = delthstr($key,"intpara_","");// 删除参数前缀
				$intparaVal = $val;
				$setVal = "intpara = '".$val."'";
				$val = "";
			}
			
			// 小数参数
			$decparaVal = 0;
			if(strpos($key,"decpara_") !== false)
			{
				$key = delthstr($key,"decpara_","");// 删除参数前缀
				$decparaVal = $val;
				$setVal = "decpara = '".$val."'";
				$val = "";
			}
			
			// 文本参数
			$textparaVal = "";
			if(strpos($key,"textpara_") !== false)
			{
				$key = delthstr($key,"textpara_","");// 删除参数前缀
				$textparaVal = $val;
				$setVal = "textpara = '".$val."'";
				$val = "";
			}
			
			// 参数字段类型设置-------------------------------------------------------------END
			
			/* 判断自定义的参数内容是否存在 */
			$listattrid = moduleaqvarval('listattrid','intval');
			$listattrwhere = "";
			if($listattrid)$listattrwhere = "and listattrid='".$listattrid."'";
			
			$wherelang = "";
			if($configinfo['lang'])$wherelang = "and lang = '".$configinfo['lang']."'";
			$sql = "SELECT paraid FROM $table_modulepara_para_list WHERE listid = '$dataid' $listattrwhere and module = '$module' $wherelang and paraid = '$key'";
			$plist = $cjdb->getRow($sql);
			if(!empty($plist))
			{
				$sql = "UPDATE $table_modulepara_para_list SET {$setVal}, recok = '".$precok."', systemok='".$systemok."'". " WHERE listid = '".$dataid."' $listattrwhere $wherelang AND paraid = '".$key."' $plistmodulewhere";
				$cjdb->query($sql);
				
			/* 参数内容不存在时插入内容 */
			}else{
				$sql = "INSERT INTO $table_modulepara_para_list (listid, attrid, listattrid, attrparaid, paraid, info, tintpara, intpara, decpara, textpara, type, recok, classid, module, systemok, lang) ". "VALUES ('".$dataid."', '".$attrid."', '".moduleaqvarval('listattrid','intval')."', '".$attrparaid."', '".$key."', '".$val."', '".$tintparaVal."', '".$intparaVal."', '".$decparaVal."', '".$textparaVal."', '$ptype', '$precok', '".$columnid."', '$module', '$systemok', '".$configinfo['lang']."')";
				$cjdb->query($sql);
			}
		}
	}
	if(is_array($getdataparameter['parameter_list']))
	{
		foreach($getdataparameter['parameter_list'] as $klist=>$vlist)
		{
			/* 判断自定义的表格参数内容是否存在 */
			$listattrid = moduleaqvarval('listattrid','intval');
			$listattrwhere = "";
			if($listattrid)$listattrwhere = "and listattrid='".$listattrid."'";
			$wherelang = "";
			if($configinfo['lang'])$wherelang = "and lang = '".$configinfo['lang']."'";
			$sql = "SELECT * FROM $table_modulepara_para_lists WHERE listid = '$dataid' and keyid = '$klist' $listattrwhere and module = '$module' $wherelang";
			$plistslist = $cjdb->getRow($sql);
			if(!empty($plistslist))
			{
				$parameter_list = "";
				foreach($vlist as $key=>$val)
				{
					$aqkey = moduleaqvarval($key, "string", "data");
					$parameter_list .= ",`$aqkey`='$val'";
				}
				$parameter_list = substr($parameter_list, 1);
				$sql = "UPDATE $table_modulepara_para_lists SET $parameter_list". ", systemok='".$systemok."' WHERE listid = '".$dataid."' and keyid = '$klist' $listattrwhere $wherelang $plistmodulewhere";
				$cjdb->query($sql);
			}else{
				$parameter_list_key="";$parameter_list_val="";
				foreach($vlist as $key=>$val)
				{
					$aqkey = moduleaqvarval($key, "string", "data");
					$parameter_list_key .= ",`$aqkey`";
					$parameter_list_val .= ",'$val'";
				}
				$parameter_list_key = substr($parameter_list_key, 1);
				$parameter_list_val = substr($parameter_list_val, 1);
				$sql = "INSERT INTO $table_modulepara_para_lists (".$parameter_list_key.",`listid`,`attrid`,`listattrid`,`module`,`systemok`,`lang`) ". "VALUES (".$parameter_list_val.", '$dataid', '$attrid', '".moduleaqvarval('listattrid','intval')."','$module','$systemok','".$configinfo['lang']."')";
				$cjdb->query($sql);
			}
		}
	}	
	if(is_array($getdataparameter['parameter_json']))
	{
		$parameter_json = moduledatajoin(getjsonstr($getdataparameter['parameter_json']));
		$sql = "UPDATE $tablename SET `parameter` = '$parameter_json'". " WHERE $dataidname = '".$dataid."' $modulewhere";
		$cjdb->query($sql);
	}
	if(is_array($getdataparameter['parameter_default']))
	{
		// 删除默认表模块参数中不可修改操作的系统字段
		unset($getdataparameter['parameter_default']['module']);// module字段
		unset($getdataparameter['parameter_default']['class2']);// class2字段
		unset($getdataparameter['parameter_default']['class3']);// class3字段
		if($configinfo['supplierok'] == 1)
		{
			unset($getdataparameter['parameter_default']['supplier_id']);// 商家ID字段
			unset($getdataparameter['parameter_default']['supplier_status']);// 商家状态字段
		}
		// 配置的不可修改的系统字段
		$deffieldpri = getstrtoarr(",", $configinfo['deffieldpri']);
		foreach($deffieldpri as $key=>$val)
		{
			if($getdataparameter['parameter_default'][$val])
			{
				unset($getdataparameter['parameter_default'][$val]);	
				return array('error' => 1, 'message' => "您当前的修改存在非法字段！".$field."|");exit;
			}
		}
		foreach($getdataparameter['parameter_default'] as $key=>$val)
		{
			if($val)
			{
				// 默认类型
				$datatype = 0;
				if(ifstr($key,"type_") == 1)
				{
					// 图片类型
					if(strpos($key,"imgtype_") !== false)
					{
						$datatype = 1;
					}
					// 文件类型
					if(strpos($key,"filetype_") !== false)
					{
						$datatype = 2;
					}
					// 数组类型
					if(strpos($key,"arrtype_") !== false)
					{
						$datatype = 3;
						$val = getarrtostr(",",$val);
					}
					// JSON类型
					if(strpos($key,"jsontype_") !== false)
					{
						$datatype = 4;
						$val = moduledatajoin(getjsonstr($val));
					}
					// 日期类型
					if(strpos($key,"datetype_") !== false)
					{
						$datatype = 5;
						$val = strtotime($val);
					}
				}
				
				$aqkey = moduleaqvarval($key, "string", "data");
				$sql = "UPDATE $tablename SET `$aqkey` = '$val'". " WHERE $dataidname = '".$dataid."' $modulewhere";
				$cjdb->query($sql);
			}
		}
	}
	
	// 默认文章模块时
	if($topmodule=="article")
	{
		// 当前栏目配置信息
		// 新增模块其它配置多级栏目参数配置 DATE:2020-5-30 START
		$expmodule_topid = gettopid($topmoduleid,"expmodule",$outmodule,$outtopid);
		// 新增模块其它配置多级栏目参数配置 DATE:2020-5-30 END
		$topmodule_expmodule = gettopmodule($expmodule_topid,"expmodule");
		
		// 关联表修改
		if(is_array(@$topmodule_expmodule['parameter_attr_tablename']))
		{
			$sql = "SELECT * FROM $tablename WHERE $dataidname=".$dataid;
			$attrmodule = $cjdb->getRow($sql);	
			
			// 关联设置
			if(!empty($attrmodule['attrset']))
			{
				$attri = -1;
				foreach($topmodule_expmodule['parameter_attr_tablename'] as $attrkey=>$attrval)
				{
					$attri++;
					if(moduleaqvarval(array('parameter_attr',$attrkey),'array'))$getdataparameter['parameter_attr'][$attrkey] = moduleaqvarval(array('parameter_attr',$attrkey),'array');
					if($tablename && (is_array($getdataparameter['parameter_attr'][$attrkey]) || $topmodule_expmodule['parameter_attr_set'][$attrkey]) && moduleaqvarval('updateok','intval') == 1)
					{
						$parameter_attr = "";
						foreach($getdataparameter['parameter_attr'][$attrkey] as $key=>$val)
						{
							// 允许修改字段判断
							$parameter_attr_fieldok_arr = getstrtoarr(",",$topmodule_expmodule['parameter_attr_fieldok'][$attrkey]);
							if(in_array($key,$parameter_attr_fieldok_arr))
							{
								$aqkey = moduleaqvarval($key, "string", "data");
								$parameter_attr .= ",`$aqkey`='$val'";
							}
							if(!in_array($key,$parameter_attr_fieldok_arr))
							{
								return array('error' => 1, 'message' => "您当前的修改存在非法字段！".$key."|");exit;
							}
						}
						$parameter_attr = substr($parameter_attr, 1);
						
						$parameter_attr_set = "";
						if($topmodule_expmodule['parameter_attr_set'][$attrkey] && empty($attrmodule['attrupdate']))
						{
							if($parameter_attr)
							{
								$parameter_attr_set = ",".$topmodule_expmodule['parameter_attr_set'][$attrkey];
							}else{
								$parameter_attr_set = $topmodule_expmodule['parameter_attr_set'][$attrkey];	
							}
							
							// 关联设置增加字段配置
							$attrsetadd = getstrtoarr(",", $topmodule_expmodule['parameter_attr_data'][$attrkey]);
							$attrsetadd1_name = $attrsetadd[0];
							$attrsetadd2_name = $attrsetadd[1];
							$attrsetadd3_name = $attrsetadd[2];
							$parameter_attr_set = str_replace("{attrsetadd1}",$attrmodule[$attrsetadd1_name],$parameter_attr_set);
							$parameter_attr_set = str_replace("{attrsetadd2}",$attrmodule[$attrsetadd2_name],$parameter_attr_set);
							$parameter_attr_set = str_replace("{attrsetadd3}",$attrmodule[$attrsetadd3_name],$parameter_attr_set);
						}
						
						if($parameter_attr || $parameter_attr_set)
						{
							// 通过关联修改表关联ID进行修改/attrid
							$sql = "SELECT * FROM ".$topmodule_expmodule['parameter_attr_tablename'][$attrkey]." WHERE attrid='".$dataid."'";
							$attrupdate = $cjdb->getRow($sql);
							if(is_array($attrupdate))
							{
								$sql = "UPDATE ".$topmodule_expmodule['parameter_attr_tablename'][$attrkey]." SET $parameter_attr $parameter_attr_set WHERE attrid='".$dataid."'";
								$cjdb->query($sql);
								
							// 通过关联修改表栏目ID进行修改/id
							}else{
								$attrset = explode(',',$attrmodule['attrset']);
								$sql = "UPDATE ".$topmodule_expmodule['parameter_attr_tablename'][$attrkey]." SET $parameter_attr $parameter_attr_set WHERE ".$topmodule_expmodule['parameter_attr_where'][$attrkey]."='".$attrset[$attri]."'";
								$cjdb->query($sql);
							}
							
							$sql = "UPDATE ".$tablename." SET `attrupdate`='1' WHERE $dataidname='".$dataid."' $modulewhere";
							$cjdb->query($sql);
						}
					}
				}
			}
		}
		
		// 自定义扩展
		if(is_array($getdataparameter['parameter_exp']))
		{
			// 新增程序配置关联配置数据信息 DATE:2020-4-17 START
			$expmodule_tablename = $topmodule_expmodule['parameter_exp_tablename'];
			$expmodule_attrtitle = $topmodule_expmodule['parameter_exp_title'];
			$expmodule_attrcate = $topmodule_expmodule['parameter_exp_category'];
			// 新增程序配置关联配置数据信息 DATE:2020-4-17 END
			
			$attrtitle = explode('|',$expmodule_attrtitle);
			if(ifstr($attrtitle[1],"-"))$attrtitle[1] = getstrtoarr('-',$attrtitle[1]);
			$attrcate = explode('|',$expmodule_attrcate);
			if(ifstr($attrcate[1],"-"))$attrcate[1] = getstrtoarr('-',$attrcate[1]);
			
			$parameter_exp = "";
			foreach($getdataparameter['parameter_exp'] as $key=>$val)
			{
				$aqkey = moduleaqvarval($key, "string", "data");
				$parameter_exp .= ",`$aqkey`='$val'";
			}
			$parameter_exp = substr($parameter_exp, 1);
			$sql = "UPDATE ".$expmodule_tablename." SET {$parameter_exp},".$attrtitle[0]. "='".moduleaqvarval($attrtitle[1],'string')."',".$attrcate[0]. "='".moduleaqvarval($attrcate[1],'string')."' WHERE attrid = '".$dataid."'";
			$cjdb->query($sql);
		}
		if(is_array($getdataparameter['parameter_expplist']))
		{
			// 新增程序配置关联配置数据信息 DATE:2020-4-17 START
			$expmodule_attrplist = $topmodule_expmodule['parameter_expplist_tablename'];
			// 新增程序配置关联配置数据信息 DATE:2020-4-17 END
				
			foreach($getdataparameter['parameter_expplist'] as $key=>$val)
			{					
				$parameter_expplist = "";
				foreach($val as $key2=>$val2)
				{
					$aqkey2 = moduleaqvarval($key2, "string", "data");
					$parameter_expplist .= ",`$aqkey2`='$val2'";
				}
				$parameter_expplist = substr($parameter_expplist, 1);
				
				$sql = "UPDATE ".$expmodule_attrplist." SET $parameter_expplist WHERE attrid = '".$dataid."' and keyid = '".$key."'";
				$cjdb->query($sql);
			}
		}
	
		// 新增程序配置关联配置数据信息 DATE:2020-4-17 START
		$expmodule_attrptable = $topmodule_expmodule['parameter_expptable_tablename'];
		$expmodule_expattrtitle = $topmodule_expmodule['parameter_expptable_title'];
		$expmodule_expattrcate = $topmodule_expmodule['parameter_expptable_category'];
		// 新增程序配置关联配置数据信息 DATE:2020-4-17 END
		
		if(!empty($expmodule_attrptable))
		{
			$expptable = explode(',',$expmodule_attrptable);
			$ti = 0;
			foreach($expptable as $kt=>$ptable)
			{
				$ti++;
				$parameter_expptable = 'parameter_expptable_'.$ti;
				if($topmodule_expmodule['parameter_expptable_title'])$parameter_expptable = 'parameter_expptable_exp';
				if(moduleaqvarval($parameter_expptable,'array'))$getdataparameter[$parameter_expptable] = moduleaqvarval($parameter_expptable,'array');
				$parameter_expptable_keyval = "";
				if(is_array($getdataparameter[$parameter_expptable]))
				{
					$expattrtitle = explode('|',$expmodule_expattrtitle);
					if(ifstr($expattrtitle[1],"-"))$expattrtitle[1] = getstrtoarr('-',$expattrtitle[1]);
					$expattrcate = explode('|',$expmodule_expattrcate);
					if(ifstr($expattrcate[1],"-"))$expattrcate[1] = getstrtoarr('-',$expattrcate[1]);
						
					foreach($getdataparameter[$parameter_expptable] as $key=>$val)
					{
						$aqkey = moduleaqvarval($key, "string", "data");
						$parameter_expptable_keyval .= ",`$aqkey`='$val'";
					}
					$parameter_expptable_keyval = substr($parameter_expptable_keyval, 1);
					if($expmodule_expattrtitle && $expmodule_expattrcate)
					{
						$sql = "UPDATE ".$ptable." SET {$parameter_expptable_keyval},".$expattrtitle[0]. "='".moduleaqvarval($expattrtitle[1],'string')."',".$expattrcate[0]. "='".moduleaqvarval($expattrcate[1],'string')."'". " WHERE attrid = '".$dataid."'";
					}else{
						$sql = "UPDATE ".$ptable." SET {$parameter_expptable_keyval}". " WHERE attrid = '".$dataid."'";	
					}
					$cjdb->query($sql);
				}
			}
		}
	}
	
	return $result;
}

// 调用模块栏目配置参数
/* 使用方法：if($article['cat_id'])
{
	$topid = gettopclass('ecs_article_cat', $article['cat_id'], 'cat_id', 'parent_id');
	$contenthtml = configmoduleparameter(moduleaqvarval('id','intval'));
	$smarty->assign('contenthtml', $contenthtml);
}*/
function configmoduleparameter($dataid = 0, $topid = 0, $tablename = "", $dataidname = "", $module="article")
{
	global $lang;
	global $_MGPC_POST,$_MGPC_GET,$_MGPC_REQ,$_MGPC_COOKIE,$_MGPC_SESSION,$configlang,$configinfo,$configblock,$configcommon,$configmember,$configbase,$configsystem,$configindex,$configother;
	global $cjdb,$parameter_out,$fanyi,$getmoduleconfig;
	$get = $GLOBALS['_MGPC_GET'];$post = $GLOBALS['_MGPC_POST'];	
	global $supplier_id;
	
	// 新增复制数据
	if($configinfo['langfanyiok'] == 1)
	{
		$copyid = moduleaqvarval('copyid','intval');
		if(!empty($copyid))
		{
			$dataid = $copyid;
		}
	}
	
	// 模块信息配置 DATE：2020-4-9 START
	$topmodule = $module;// 当前主模块
	$topid = !empty($topid) ? $topid : $configinfo['moduleid'];// 当前模块ID
	$topmoduleid = $topid;// 当前主模块ID
	$topmoduleinfo = columninfo($configinfo['ecs_article_cat'],$topmoduleid,$configinfo['cat_id']);
	$outmodule = $module=="article" && $topmoduleid != $configinfo['moduleid'] ? 1 : 0;
	$outtopid = !empty($getmoduleconfig['outtopid']) ? $getmoduleconfig['outtopid'] : ($outmodule == 1 ? $topid : 0);// 外部配置栏目ID
	$outparaclassid = isset($getmoduleconfig['outparaclassid']) ? $getmoduleconfig['outparaclassid'] : "all";// 外部配置栏目参数分类ID 用isset判断支持ID为0
	// 模块信息配置 DATE：2020-4-9 END
	
	// 加载默认模块表
	$tablename = !empty($tablename) ? $tablename : $configinfo['ecs_article'];
	if(ifstr($tablename, $configinfo['ecs_article']) == 1)
	{
		$dataidname = !empty($dataidname) ? $dataidname : $configinfo['article_id'];
	}
	// 新增自定义模块独立表配置 DATE:2020-3-27 START
	if($topmodule=="article")
	{
		$moduletable = getmoduletable($topmoduleid);
		$topmodule_defaultmoduletable = gettopmodule("default","moduletable");
		if($moduletable != $topmodule_defaultmoduletable["tablename"])
		{
			$tablename = $moduletable;
		}
	}
	// 新增自定义模块独立表配置 DATE:2020-3-27 END
	
	// 新增重组模块参数表
	if($topmodule=="article")
	{
		$table_modulepara_para_list = "modulepara_para_list";
		$table_modulepara_para_lists = "modulepara_para_lists";
		$module=$module.$topmoduleid;
		// 新增自定义模块独立表配置 DATE:2020-3-27 START
		$moduleplist = getmoduleplist($topmoduleid);
		if($moduleplist != "article")
		{
			$table_modulepara_para_list = "modulepara_para_list_".$moduleplist;	
			$table_modulepara_para_lists = "modulepara_para_lists_".$moduleplist;	
		}
		// 新增自定义模块独立表配置 DATE:2020-3-27 END
	}else{
		$table_modulepara_para_list = "modulepara_para_list_".$module;	
		$table_modulepara_para_lists = "modulepara_para_lists_".$module;	
	}
	
	// 新增模块多级栏目参数配置 DATE:2020-4-28 START
	$topid = gettopid($topid,"default",$outmodule,$outtopid);
	// 新增模块多级栏目参数配置 DATE:2020-4-28 END
	
	// 操作数据ID存在时
	if($dataid)
	{
		// 当前数据表
		$sql = "SELECT * FROM $tablename WHERE $dataidname=".$dataid;
		$defaultdata = $cjdb->getRow($sql);	

		// 商家操作数据权限（只允许操作自己的数据，限制非法操作其它商家的数据）
		// 支持所有模块商家权限判断
		if($supplier_id)
		{
			if($defaultdata['supplier_id'] != $supplier_id)
			{
				moduleerror(array("message"=>"Error:非法操作！商家只能操作自己的数据！"));
			}
		}

		// 会员操作数据权限（只允许操作自己的数据，限制非法操作其它会员的数据）
		// 支持所有模块会员权限判断
		if($configinfo['modulepara'] == 'pc' || $configinfo['modulepara'] == 'mobile' || $configinfo['modulepara'] == 'xcx')
		{
			if($configinfo['expmember_uid'] && $defaultdata['user_id'] != $configinfo['expmember_uid'])
			{
				moduleerror(array("message"=>"Error:非法操作！会员只能操作自己的数据！"));
			}
		}
	}
	
	// 开启内容实体转换
	$contentok = $configinfo['contentok'];
	if(isset($parameter_out['contentok']))$contentok = $parameter_out['contentok'];// 支持外部开启配置

	// 初始化模块参数
	global $parameter;
	global $parameter_list;
	global $parameter_json;
	global $parameter_default;
	global $parameter_exp;
	global $parameter_expplist;
	global $parameter_exptable;
	global $parameter_attr;
	global $parameter_other;
	global $moduleparameter;
	$parameter = array();
	$parameter_list = array();
	$parameter_json = array();
	$parameter_default = array();
	$parameter_exp = array();
	$parameter_expplist = array();
	$parameter_exptable = array();
	$parameter_attr = array();
	$parameter_other = array();
	$moduleparameter = array();
	
	// 操作数据ID存在时
	if($dataid)
	{	
		/* 获取对应参数值 */
		$listattrid = moduleaqvarval('listattrid','intval');
		$listattrwhere = "";
		if($listattrid)$listattrwhere = "and listattrid='".$listattrid."'";
		$wherelang = "";
		if($configinfo['lang'])$wherelang = "and lang = '".$configinfo['lang']."'";
		if($copyid)$wherelang = "and lang = 'cn'";
		$sql = "SELECT * FROM $table_modulepara_para_list WHERE listid='".$dataid."' $listattrwhere and module = '$module' $wherelang";
		$plist = $cjdb->getAll($sql);
		foreach($plist as $key=>$val)
		{
			// 参数字段类型设置-------------------------------------------------------------START
			
			// 小型整数参数
			if(!empty($val['tintpara']))
			{
				$val['info'] = $val['tintpara'];
			}
			
			// 整数参数
			if(!empty($val['intpara']))
			{
				$val['info'] = $val['intpara'];
			}
			
			// 小数参数
			if($val['decpara'] > 0)
			{
				$val['info'] = $val['decpara'];
			}
			
			// 文本参数
			if(!empty($val['textpara']))
			{
				$val['info'] = $val['textpara'];
			}
			
			// 参数字段类型设置-------------------------------------------------------------END
			
			// 参数类型为数组时转换为数组
			if($val['type'] == 3)
			{
				$parameter['arrtype_'.$val['paraid']] = $val['info'];// 原数组字符串数据
				$infoarr = getstrtoarr(",",$val['info']);
				$val['info'] = $infoarr;
			}
			
			// 参数类型为JSON时转换为数组
			if($val['type'] == 4)
			{
				$parameter['jsontype_'.$val['paraid']] = moduledatajoin($val['info']);// 原JSON字符串数据
				$infoarr = getjsonarr($val['info']);
				$val['info'] = $infoarr;
			}
			
			// 参数类型为DATE时格式化日期
			if($val['type'] == 5)
			{
				$parameter['datetype_'.$val['paraid']] = $val['info'];// 原JSON字符串数据
				$infoarr = date('Y-m-d',$val['info']);
				$parameter['complete_'.$val['paraid']] = date('Y-m-d H:i:s',$val['info']);
				$val['info'] = $infoarr;
			}
			
			// 订购参数
			if($val['type'] == 13)
			{
				$parameter_other['goodsparameter'][$val['paraid']] = $val['info'];	
			}
			
			// 关联参数
			if(!empty($val['listattrid']))
			{
				$val['paraid'] = "listattr_".$val['listattrid']."_".$val['paraid'];
			}
			
			$parameter[$val['paraid']] = $val['info'];
		}
		if($contentok)
		{
			if($configinfo['contenthsc'] == 1)
			{
				if(isset($parameter['contenthsc1']))$parameter['contenthsc1'] = htmlspecialchars($parameter['contenthsc1']);
				if(isset($parameter['contenthsc2']))$parameter['contenthsc2'] = htmlspecialchars($parameter['contenthsc2']);
				if(isset($parameter['contenthsc3']))$parameter['contenthsc3'] = htmlspecialchars($parameter['contenthsc3']);
				if(isset($parameter['contenthsc4']))$parameter['contenthsc4'] = htmlspecialchars($parameter['contenthsc4']);
				if(isset($parameter['contenthsc5']))$parameter['contenthsc5'] = htmlspecialchars($parameter['contenthsc5']);
				if(isset($parameter['contenthsc6']))$parameter['contenthsc6'] = htmlspecialchars($parameter['contenthsc6']);
				if(isset($parameter['contenthsc7']))$parameter['contenthsc7'] = htmlspecialchars($parameter['contenthsc7']);
				if(isset($parameter['contenthsc8']))$parameter['contenthsc8'] = htmlspecialchars($parameter['contenthsc8']);
				if(isset($parameter['contenthsc9']))$parameter['contenthsc9'] = htmlspecialchars($parameter['contenthsc9']);
				if(isset($parameter['contenthsc10']))$parameter['contenthsc10'] = htmlspecialchars($parameter['contenthsc10']);
			}
			if($configinfo['contenthsc'] == 2)
			{
				if(isset($parameter['contenthsc1']))$parameter['contenthsc1'] = htmlspecialchars_decode($parameter['contenthsc1']);
				if(isset($parameter['contenthsc2']))$parameter['contenthsc2'] = htmlspecialchars_decode($parameter['contenthsc2']);
				if(isset($parameter['contenthsc3']))$parameter['contenthsc3'] = htmlspecialchars_decode($parameter['contenthsc3']);
				if(isset($parameter['contenthsc4']))$parameter['contenthsc4'] = htmlspecialchars_decode($parameter['contenthsc4']);
				if(isset($parameter['contenthsc5']))$parameter['contenthsc5'] = htmlspecialchars_decode($parameter['contenthsc5']);
				if(isset($parameter['contenthsc6']))$parameter['contenthsc6'] = htmlspecialchars_decode($parameter['contenthsc6']);
				if(isset($parameter['contenthsc7']))$parameter['contenthsc7'] = htmlspecialchars_decode($parameter['contenthsc7']);
				if(isset($parameter['contenthsc8']))$parameter['contenthsc8'] = htmlspecialchars_decode($parameter['contenthsc8']);
				if(isset($parameter['contenthsc9']))$parameter['contenthsc9'] = htmlspecialchars_decode($parameter['contenthsc9']);
				if(isset($parameter['contenthsc10']))$parameter['contenthsc10'] = htmlspecialchars_decode($parameter['contenthsc10']);
			}
		}
		
		// 创建列表参数
		$listattrid = moduleaqvarval('listattrid','intval');
		$listattrwhere = "";
		if($listattrid)$listattrwhere = "and listattrid='".$listattrid."'";
		$wherelang = "";
		if($configinfo['lang'])$wherelang = "and lang = '".$configinfo['lang']."'";
		$sql = "SELECT * FROM $table_modulepara_para_lists WHERE listid='".$dataid."' $listattrwhere and module = '$module' $wherelang";
		$parameter_list = $cjdb->getRow($sql);
		
		// 创建栏目JSON参数
		$sql = "SELECT * FROM $tablename WHERE $dataidname='".$dataid."'";
		$parameter_json = $cjdb->getRow($sql);	
		
		// 将parameter参数JSON格式转换成数组
		$datavalue = json_decode($parameter_json['parameter'], true);
		if (is_array($datavalue)) {
			$parameter_json = $datavalue;
		}
		
		// 创建栏目默认参数
		$sql = "SELECT * FROM $tablename WHERE $dataidname='".$dataid."'";
		$parameter_default = $cjdb->getRow($sql);
		foreach($parameter_default as $key=>$val)
		{
			if(ifstr($key,"type_") == 1)
			{				
				// 参数类型为数组时转换为数组
				if(ifstr($key, "arrtype_") == 1)
				{
					$parameter_default['original_'.$key] = $val;// 原数组字符串数据
					$infoarr = getstrtoarr(",",$val);
					$parameter_default[$key] = $infoarr;
				}
				
				// 参数类型为JSON时转换为数组
				if(ifstr($key, "jsontype_") == 1)
				{
					$parameter_default['original_'.$key] = moduledatajoin($val);// 原JSON字符串数据
					$infoarr = getjsonarr($val);
					$parameter_default[$key] = $infoarr;
				}
				
				// 参数类型为DATE时格式化日期
				if(ifstr($key, "datetype_") == 1)
				{
					$parameter_default['original_'.$key] = $val;// 原JSON字符串数据
					$infoarr = date('Y-m-d',$val);
					$parameter_default['complete_'.$key] = date('Y-m-d H:i:s',$val);
					$parameter_default[$key] = $infoarr;
				}
			}
		}
		if($contentok)
		{
			if($configinfo['contenthsc'] == 1)
			{
				@$parameter_default[$configinfo['contentfield']] = htmlspecialchars($parameter_default[$configinfo['contentfield']]);
				if(isset($parameter_default['contentmobile']))$parameter_default['contentmobile'] = htmlspecialchars($parameter_default['contentmobile']);// 手机版内容
			}
			if($configinfo['contenthsc'] == 2)
			{
				@$parameter_default[$configinfo['contentfield']] = htmlspecialchars_decode($parameter_default[$configinfo['contentfield']]);
				if(isset($parameter_default['contentmobile']))$parameter_default['contentmobile'] = htmlspecialchars_decode($parameter_default['contentmobile']);// 手机版内容
			}
		}
		
		// 默认文章模块时
		if($topmodule=="article")
		{
			// 新增多语言自动翻译数据
			if($configinfo['langfanyiok'] == 1 && $copyid)
			{
				// 默认数据
				foreach($parameter_default as $key=>$val)
				{
					if(isJson($val))
					{
						$infoarr = getjsonarr($val);
						foreach($infoarr as $k=>$v)
						{
							if(ifzh($v) > 0 && $v)
							{
								$parameter_default_fanyi[$key][$k] = $v;
								$fanyitext .= $v."\n";
							}
						}
						$parameter_default[$key] = getjsonstr($infoarr);
						
					}else{
						if(ifzh($val) > 0 && $val)
						{
							$parameter_default_fanyi[$key] = $val;
							$fanyitext .= $val."\n";
						}
					}
				}
			}	
			
			// 新增多语言自动翻译数据
			if($configinfo['langfanyiok'] == 1 && $copyid)
			{
				// 参数
				foreach($parameter as $key=>$val)
				{
					if(is_array($val))
					{
						foreach($val as $k=>$v)
						{
							if(ifzh($v) > 0 && $v)
							{
								$parameter_fanyi[$key][$k] = $v;
								$fanyitext .= $v."\n";
							}
						}
					}else{
						if(ifzh($val) > 0 && $val)
						{
							$parameter_fanyi[$key] = $val;
							$fanyitext .= $val."\n";
						}
					}
				}
			}
			
			// 新增多语言自动翻译数据
			if($configinfo['langfanyiok'] == 1 && $copyid)
			{
				$fanyidata=$fanyi->fanyi($fanyitext,'zh',$configinfo['langfanyimark'][$lang]);
				foreach($fanyidata as $datakey=>$dataval)
				{
					// 参数
					foreach($parameter_fanyi as $fanyikey=>$fanyival)
					{
						if(is_array($fanyival))
						{
							foreach($fanyival as $k=>$v)
							{
								if($dataval['ytext'] == $v)
								{
									$parameter[$fanyikey][$k]=$dataval['ftext'];
								}
							}
						}else{
							if($dataval['ytext'] == $fanyival)
							{
								$parameter[$fanyikey]=$dataval['ftext'];
							}	
						}
					}
					// 默认数据
					foreach($parameter_default_fanyi as $fanyikey=>$fanyival)
					{
						if(is_array($fanyival))
						{
							foreach($fanyival as $k=>$v)
							{
								if($dataval['ytext'] == $v)
								{
									$parameter_default[$fanyikey][$k]=$dataval['ftext'];
								}
							}
						}else{
							if($dataval['ytext'] == $fanyival)
							{
								$parameter_default[$fanyikey]=$dataval['ftext'];
							}	
						}
					}
				}
			}
			
			// 当前栏目配置信息
			// 新增模块其它配置多级栏目参数配置 DATE:2020-5-30 START
			$expmodule_topid = gettopid($topmoduleid,"expmodule",$outmodule,$outtopid);
			// 新增模块其它配置多级栏目参数配置 DATE:2020-5-30 END
			$topmodule_expmodule = gettopmodule($expmodule_topid,"expmodule");
			
			// 创建关联修改
			if(is_array($topmodule_expmodule['parameter_attr_tablename']))
			{
				$sql = "SELECT * FROM $tablename WHERE $dataidname='".$dataid."'";
				$expmodule = $cjdb->getRow($sql);
				
				foreach($topmodule_expmodule['parameter_attr_tablename'] as $attrkey=>$attrval)
				{
					$sql = "SELECT * FROM ".$topmodule_expmodule['parameter_attr_tablename'][$attrkey]." WHERE attrid='".$dataid."'";
					$parameter_attr[$attrkey] = $cjdb->getRow($sql);
				}
			}
		
			// 创建扩展模块
			$expmodule_tablename = $topmodule_expmodule['parameter_exp_tablename'];
			$expmodule_attrplist = $topmodule_expmodule['parameter_expplist_tablename'];
			$expmodule_attrptable = $topmodule_expmodule['parameter_expptable_tablename'];
			if($expmodule_tablename)
			{
				$sql = "SELECT * FROM ".$expmodule_tablename." WHERE attrid='".$dataid."'";
				$parameter_exp = $cjdb->getRow($sql);
			}
			if($expmodule_attrplist)
			{
				$sql = "SELECT * FROM ".$expmodule_attrplist." WHERE attrid='".$dataid."'";
				$parameter_expplist = $cjdb->getAll($sql);
			}
			if($expmodule_attrptable)
			{
				$expptable = explode(',',$expmodule_attrptable);
				$ti = 0;
				foreach($expptable as $kt=>$ptable)
				{
					$ti++;
					$parameter_expptable = 'parameter_expptable_'.$ti;
					if($topmodule_expmodule['parameter_expptable_title'])$parameter_expptable = 'parameter_expptable_exp';
					$sql = "SELECT * FROM ".$ptable." WHERE attrid='".$dataid."'";
					$$parameter_expptable = $cjdb->getRow($sql);
				}
			}
		}
	}
	
	// ** 模块参数配置信息 **************************************************************************************START
	
	// 当前栏目配置信息
	$topmodule_module = gettopmodule($topid);
	
	// 新增模块数据配置 DATE:2020-4-25 START
	$contenthtml = $topmodule_module['contenthtml'];
	$contentmobilehtml = $topmodule_module['contentmobilehtml'];
	$xcxcontentmobilehtml = $topmodule_module['xcxcontentmobilehtml'];
	$morecontenthtml1 = $topmodule_module['morecontenthtml1'];
	$morecontenthtml2 = $topmodule_module['morecontenthtml2'];
	$morecontenthtml3 = $topmodule_module['morecontenthtml3'];
	$contentfunhtml = $topmodule_module['contentfunhtml'];
	if($dataid && $topmodule_module['data'])
	{
		$datamodule = $topmodule_module['data'][$dataid];
		$modulepath = MODULEPARA_PATH;
		$tplok = gettplok($topid);
		if($tplok == 1)
		{
			// 加载模板程序配置
			if($configinfo['tplok'] == 1)
			{
				$modulepath = $configinfo['tplurl'];
			}
		}
		$dataparahtml = file_get_contents($modulepath."/config/module/".$datamodule['para']);
		$contenthtml = $dataparahtml;
		$datamorepara1html = file_get_contents($modulepath."/config/module/".$datamodule['morepara1']);
		$morecontenthtml1 = $datamorepara1html;
		$datamorepara2html = file_get_contents($modulepath."/config/module/".$datamodule['morepara2']);
		$morecontenthtml2 = $datamorepara2html;
		$datamorepara3html = file_get_contents($modulepath."/config/module/".$datamodule['morepara3']);
		$morecontenthtml3 = $datamorepara3html;
		$dataparafunhtml = file_get_contents($modulepath."/config/module/".$datamodule['parafun']);
		$contentfunhtml = $dataparafunhtml;
	}
	// 新增模块数据配置 DATE:2020-4-25 END
	
	$morecontenthtml4 = $topmodule_module['morecontenthtml4'];	
	$morecontenthtml5 = $topmodule_module['morecontenthtml5'];	
	
	// 默认文章模块时
	if($topmodule=="article")
	{
		// 新增加载内容代码配置程序
		$moduledir = $configinfo['modulepara'] != "admin" ? "configmodule" : "configmodulepara";
		include(MODULEPARA_PATH.'/configmodule/'.$moduledir.'/module/article/config.php');
		if($configinfo['tplok'] == 1)
		{
			include($configinfo['tplurl'].'/configmodule/'.$moduledir.'/module/article/config.php');
		}
	}else{
		// 新增加载内容代码配置程序
		include(MODULEPARA_PATH.'/configmodule/configmodulepara/module/'.$topmodule.'/config.php');
		if($configinfo['tplok'] == 1)
		{
			include($configinfo['tplurl'].'/configmodule/configmodulepara/module/'.$topmodule.'/config.php');
		}	
	}
	
	// 新增模块程序配置
	if($configinfo['modulepara'] != "admin")
	{
		$contenthtml = $contentmobilehtml;// 前台模块参数信息开启
		// 新增小程序前台模块参数信息 DATE：2019-12-25 START
		if($configinfo['webuser'] == "xcx")
		{
			$contenthtml = $xcxcontentmobilehtml;// 前台模块参数信息开启
		}
		// 新增小程序前台模块参数信息 DATE：2019-12-25 END
	}
	
	// 新增加载动态模板数据 DATE:2020-10-23 START
	$zdyhtmlarr = getstrtoarr(',', $configinfo['zdyhtml']);
	if(!in_array($configinfo['column1id'],$zdyhtmlarr))
	{
		$tpldata = array();
		$tpldata['parameter_out'] = $parameter_out;
		$tpldata['getmoduleconfig'] = $getmoduleconfig;
		$tpldata['get'] = $get;
		$tpldata['post'] = $post;
		$tpldata['parameter'] = $parameter;
		$tpldata['parameter_list'] = $parameter_list;
		$tpldata['parameter_json'] = $parameter_json;
		$tpldata['parameter_default'] = $parameter_default;
		$tpldata['parameter_exp'] = $parameter_exp;
		$tpldata['parameter_expplist'] = $parameter_expplist;
		$tpldata['parameter_exptable'] = $parameter_exptable;
		$tpldata['parameter_attr'] = $parameter_attr;
		$tpldata['parameter_other'] = $parameter_other;
		$tpldata['moduleparameter'] = $moduleparameter;
		
		$loadtpl_contenthtml = getloadtpldata('contenthtml', $tpldata, $contenthtml);
		if($loadtpl_contenthtml['error'] == 0)$contenthtml = $loadtpl_contenthtml['datacontent'];
		
		$loadtpl_contentmobilehtml = getloadtpldata('contentmobilehtml', $tpldata, $contentmobilehtml);
		if($loadtpl_contentmobilehtml['error'] == 0)$contentmobilehtml = $loadtpl_contentmobilehtml['datacontent'];
		
		$loadtpl_xcxcontentmobilehtml = getloadtpldata('xcxcontentmobilehtml', $tpldata, $xcxcontentmobilehtml);
		if($loadtpl_xcxcontentmobilehtml['error'] == 0)$xcxcontentmobilehtml = $loadtpl_xcxcontentmobilehtml['datacontent'];
			
		$loadtpl_morecontenthtml1 = getloadtpldata('morecontenthtml1', $tpldata, $morecontenthtml1);
		if($loadtpl_morecontenthtml1['error'] == 0)$morecontenthtml1 = $loadtpl_morecontenthtml1['datacontent'];
		
		$loadtpl_morecontenthtml2 = getloadtpldata('morecontenthtml2', $tpldata, $morecontenthtml2);
		if($loadtpl_morecontenthtml2['error'] == 0)$morecontenthtml2 = $loadtpl_morecontenthtml2['datacontent'];
		
		$loadtpl_morecontenthtml3 = getloadtpldata('morecontenthtml3', $tpldata, $morecontenthtml3);
		if($loadtpl_morecontenthtml3['error'] == 0)$morecontenthtml3 = $loadtpl_morecontenthtml3['datacontent'];
		
		$loadtpl_morecontenthtml4 = getloadtpldata('morecontenthtml4', $tpldata, $morecontenthtml4);
		if($loadtpl_morecontenthtml4['error'] == 0)$morecontenthtml4 = $loadtpl_morecontenthtml4['datacontent'];
		
		$loadtpl_morecontenthtml5 = getloadtpldata('morecontenthtml5', $tpldata, $morecontenthtml5);
		if($loadtpl_morecontenthtml5['error'] == 0)$morecontenthtml5 = $loadtpl_morecontenthtml5['datacontent'];
		
		if($dataid && $topmodule_module['data'])
		{
			$loadtpl_dataparahtml = getloadtpldata('dataparahtml', $tpldata, $dataparahtml);
			if($loadtpl_dataparahtml['error'] == 0)$contenthtml = $loadtpl_dataparahtml['datacontent'];
			
			$loadtpl_datamorepara1html = getloadtpldata('datamorepara1html', $tpldata, $datamorepara1html);
			if($loadtpl_datamorepara1html['error'] == 0)$morecontenthtml1 = $loadtpl_datamorepara1html['datacontent'];
			
			$loadtpl_datamorepara2html = getloadtpldata('datamorepara2html', $tpldata, $datamorepara2html);
			if($loadtpl_datamorepara2html['error'] == 0)$morecontenthtml2 = $loadtpl_datamorepara2html['datacontent'];
			
			$loadtpl_datamorepara3html = getloadtpldata('datamorepara3html', $tpldata, $datamorepara3html);
			if($loadtpl_datamorepara3html['error'] == 0)$morecontenthtml3 = $loadtpl_datamorepara3html['datacontent'];
		}
	}
	// 新增加载动态模板数据 DATE:2020-10-23 END	
	
	// 内容HTML变量数组解析
	$contenthtml = str_replace("#modulel;","<",$contenthtml);
	$contenthtml = str_replace("#moduleg;",">",$contenthtml);
	$contenthtml = htmlspecialchars_decode($contenthtml);
	require(MODULEPARA_BASE_PATH . '/service/VarokService.php');
	
	// 新增模板解析函数与变量
	// 仅限模块程序配置
	if(!in_array($configinfo['column1id'],$zdyhtmlarr))
	{
		eval($contentfunhtml);// 执行字符串中的函数
		$contenthtml = addslashes($contenthtml);
		eval("\$contenthtml = \"$contenthtml\";");// 执行字符串中的变量
		$contenthtml = moduledatarevert($contenthtml);
	}
	
	// 更多内容HTML
	$morecontenthtml1 = str_replace("#modulel;","<",$morecontenthtml1);
	$morecontenthtml1 = str_replace("#moduleg;",">",$morecontenthtml1);
	$morecontenthtml1 = htmlspecialchars_decode($morecontenthtml1);
	$morecontenthtml1 = phpvarok($morecontenthtml1,"modulepara");
	
	$morecontenthtml2 = str_replace("#modulel;","<",$morecontenthtml2);
	$morecontenthtml2 = str_replace("#moduleg;",">",$morecontenthtml2);
	$morecontenthtml2 = htmlspecialchars_decode($morecontenthtml2);
	$morecontenthtml2 = phpvarok($morecontenthtml2,"modulepara");
	
	$morecontenthtml3 = str_replace("#modulel;","<",$morecontenthtml3);
	$morecontenthtml3 = str_replace("#moduleg;",">",$morecontenthtml3);
	$morecontenthtml3 = htmlspecialchars_decode($morecontenthtml3);
	$morecontenthtml3 = phpvarok($morecontenthtml3,"modulepara");
	
	$morecontenthtml4 = str_replace("#modulel;","<",$morecontenthtml4);
	$morecontenthtml4 = str_replace("#moduleg;",">",$morecontenthtml4);
	$morecontenthtml4 = htmlspecialchars_decode($morecontenthtml4);
	$morecontenthtml4 = phpvarok($morecontenthtml4,"modulepara");
	
	$morecontenthtml5 = str_replace("#modulel;","<",$morecontenthtml5);
	$morecontenthtml5 = str_replace("#moduleg;",">",$morecontenthtml5);
	$morecontenthtml5 = htmlspecialchars_decode($morecontenthtml5);
	$morecontenthtml5 = phpvarok($morecontenthtml5,"modulepara");
	
	// 新增模板解析函数与变量
	// 仅限模块程序配置
	if(!in_array($configinfo['column1id'],$zdyhtmlarr))
	{
		$morecontenthtml1 = addslashes($morecontenthtml1);
		eval("\$morecontenthtml1 = \"$morecontenthtml1\";");// 执行字符串中的变量
		$morecontenthtml1 = moduledatarevert($morecontenthtml1);
		
		$morecontenthtml2 = addslashes($morecontenthtml2);
		eval("\$morecontenthtml2 = \"$morecontenthtml2\";");// 执行字符串中的变量
		$morecontenthtml2 = moduledatarevert($morecontenthtml2);
		
		$morecontenthtml3 = addslashes($morecontenthtml3);
		eval("\$morecontenthtml3 = \"$morecontenthtml3\";");// 执行字符串中的变量
		$morecontenthtml3 = moduledatarevert($morecontenthtml3);
		
		$morecontenthtml4 = addslashes($morecontenthtml4);
		eval("\$morecontenthtml4 = \"$morecontenthtml4\";");// 执行字符串中的变量
		$morecontenthtml4 = moduledatarevert($morecontenthtml4);
		
		$morecontenthtml5 = addslashes($morecontenthtml5);
		eval("\$morecontenthtml5 = \"$morecontenthtml5\";");// 执行字符串中的变量
		$morecontenthtml5 = moduledatarevert($morecontenthtml5);
	}
	
	// 默认文章模块时
	if($topmodule=="article")
	{
		// 新增后台自定义模块参数
		if($configinfo['zdypara'] == 1)
		{
			// 参数分类用于调用同张表不同模块时的不同参数调用，例如：会员资料，不同模块修改不同会员资料信息，如：简历中的 工作经验，教育信息，培训经历等不同模块
			// 使用outparaclassid传入参数分类ID，进行对应调用当前参数分类下的所有参数 参数分类=不同模块下的信息填写
			$attrparameter = getcolumnparameter($parameter,$topid,$outtopid,$outparaclassid);
			if($outparaclassid && $outparaclassid > 0)
			{
				$contenthtml = $attrparameter;
			}else{
				$contenthtml .= $attrparameter;	
			}
		}
		
		// 新增后台商品模块参数 DATE：2020-5-6 START
		if($configinfo['shopok'] == 1)
		{
			$shopparameter = getadminshopparameter($parameter,$parameter_other);
			$contenthtml .= $shopparameter;
		}
		// 新增后台商品模块参数 DATE：2020-5-6 END
	}
	
	// 模块参数HTML配置
	$moduleparameter['contenthtml'] = $contenthtml;
	
	// 更多模块参数HTML配置
	$moduleparameter['morecontenthtml1'] = $morecontenthtml1;	
	$moduleparameter['morecontenthtml2'] = $morecontenthtml2;	
	$moduleparameter['morecontenthtml3'] = $morecontenthtml3;	
	$moduleparameter['morecontenthtml4'] = $morecontenthtml4;	
	$moduleparameter['morecontenthtml5'] = $morecontenthtml5;	
	
	// 新增模板解析函数与变量
	$moduleparameter['contentfunhtml'] = $contentfunhtml;
	
	// ** 模块参数配置信息 **************************************************************************************END
	
	return $contenthtml;
}

// 获取参数信息
// 使用方法：$arr[$article_id]['parainfo'] = getmoduleparameter($article_id, 3);
function getmoduleparameter($dataid=0, $topid = 0, $getconfig = array(), $module="article")
{
	global $cjdb,$configinfo,$configlang;
	global $supplier_id;
	
	// 模块信息配置 DATE：2020-4-9 START
	$topmodule = $module;// 当前主模块
	if($getconfig)
	{
		$listattrid = !empty($getconfig['listattrid']) ? $getconfig['listattrid'] : 0;// 列表关联ID
		$phtmlok = !empty($getconfig['phtmlok']) ? $getconfig['phtmlok'] : 0;// 开启参数html调用
		$langallok = !empty($getconfig['langallok']) ? $getconfig['langallok'] : 0;// 开启所有语言数据
	}
	// 模块信息配置 DATE：2020-4-9 END
	
	// 默认文章模块时
	if($topmodule=="article")
	{
		// 加载默认模块表
		$tablename = $configinfo['ecs_article'];
		$dataidname = $configinfo['article_id'];
		
		// 新增自定义模块独立表配置 DATE:2020-3-27 START
		if(!empty($topid))
		{
			$moduletable = getmoduletable($topid);
			$topmodule_defaultmoduletable = gettopmodule("default","moduletable");
			if($moduletable != $topmodule_defaultmoduletable["tablename"])
			{
				$tablename = $moduletable;
			}
		}
		// 新增自定义模块独立表配置 DATE:2020-3-27 END
	}
	
	// 新增重组模块参数表
	if($topmodule=="article")
	{
		$table_modulepara_para_list = "modulepara_para_list";
		$table_modulepara_para_lists = "modulepara_para_lists";
		if(!empty($topid))
		{
			$module=$module.$topid;
			$modulewhere = "and module = '$module'";
		}
		// 新增自定义模块独立表配置 DATE:2020-3-27 START
		if($topid)
		{
			$moduleplist = getmoduleplist($topid);
			if($moduleplist != "article")
			{
				$table_modulepara_para_list = "modulepara_para_list_".$moduleplist;	
				$table_modulepara_para_lists = "modulepara_para_lists_".$moduleplist;	
			}
		}
		// 新增自定义模块独立表配置 DATE:2020-3-27 END
	}else{
		$table_modulepara_para_list = "modulepara_para_list_".$module;	
		$table_modulepara_para_lists = "modulepara_para_lists_".$module;	
	}
	
	/* 获取对应参数值 */
	$listattrwhere = "";
	if($listattrid)$listattrwhere = "and listattrid='".$listattrid."'";
	$wherelang = "";
	if($configinfo['lang'] && $langallok != 1)$wherelang = "and lang = '".$configinfo['lang']."'";
	$sql = "SELECT * FROM $table_modulepara_para_list WHERE listid='".$dataid."' $modulewhere $listattrwhere $wherelang";
	$plist = $cjdb->getAll($sql);
	if(is_array($plist))
	{
		$paralist = array();
		$recparalist = array();
		$defparalist = array();
		foreach($plist as $key=>$val)
		{
			// 当参数名不为空时
			if($val['paraid'])
			{
				// 参数字段类型设置-------------------------------------------------------------START
				
				// 小型整数参数
				if(!empty($val['tintpara']))
				{
					$val['info'] = $val['tintpara'];
				}
				
				// 整数参数
				if(!empty($val['intpara']))
				{
					$val['info'] = $val['intpara'];
				}
				
				// 小数参数
				if($val['decpara'] > 0)
				{
					$val['info'] = $val['decpara'];
				}
				
				// 文本参数
				if(!empty($val['textpara']))
				{
					$val['info'] = $val['textpara'];
				}
				
				// 参数字段类型设置-------------------------------------------------------------END
				
				// 参数类型为数组时转换为数组
				if($val['type'] == 3)
				{
					$infoarr = getstrtoarr(",",$val['info']);
					$val['info'] = $infoarr;
				}
				
				// 参数类型为JSON时转换为数组
				if($val['type'] == 4)
				{
					$infoarr = getjsonarr($val['info']);
					$val['info'] = $infoarr;
				}
				
				// 参数类型为DATE时格式化日期
				if($val['type'] == 5)
				{
					$infoarr = date('Y-m-d H:i:s',$val['info']);
					$val['info'] = $infoarr;
				}
				
				// 订购参数
				if($val['type'] == 13)
				{
					$goodsparanamearr = getstrtoarr('_',$val['paraid']);
					$speclistids = $goodsparanamearr[1];
					$specname = $goodsparanamearr[2];
					$shoppara_goodsparalist[$specname][$speclistids] = $val['info'];	
				}
				
				// 关联参数
				if(!empty($val['listattrid']))
				{
					$val['paraid'] = "listattr_".$val['listattrid']."_".$val['paraid'];
				}
				
				// 自定义参数名
				if(!empty($val['attrparaid']))
				{
					$attrpinfo = getattrparameterinfo($val['attrparaid']);
					$val['pname'] = $attrpinfo['name'];
				}

				// 推荐参数
				if($val['recok'] == 1)
				{
					$recparalist[] = $val;
				// 默认参数			
				}else{
					$defparalist[] = $val;
				}	
				
				// 所有参数
				$paralist[] = $val;
			}
		}
		
		// 根据当前模块重组参数名
		if($topid)
		{
			$pname = getparametername($topid);// 参数名	
			$rpname = getrecparametername($topid);// 推荐参数名	
			
			// 推荐参数
			foreach($recparalist as $key=>$val)
			{
				if(empty($val['pname']))
				{
					$recparalist[$key]['pname'] = $rpname[$val['paraid']];
				}
			}
			
			// 默认参数
			foreach($defparalist as $key=>$val)
			{
				if(empty($val['pname']))
				{
					$defparalist[$key]['pname'] = $pname[$val['paraid']];					
				}	
			}
			
			// 重组所有参数
			$paralist = hbarray($recparalist,$defparalist);
			
			// 组合模块参数组
			foreach($recparalist as $key=>$val)
			{
				$getparaarr['recparagroup'][$val['paraid']]['pname'] = $val['pname'];		
				$getparaarr['recparagroup'][$val['paraid']]['info'] = $val['info'];		
			}
			foreach($defparalist as $key=>$val)
			{
				$getparaarr['defparagroup'][$val['paraid']]['pame'] = $val['pame'];		
				$getparaarr['defparagroup'][$val['paraid']]['info'] = $val['info'];		
			}
		}
		
		foreach($paralist as $key=>$val)
		{
			$getparaarr[$val['paraid']] = $val['info'];
		}
		
		// 加入订购参数
		if($shoppara_goodsparalist)$getparaarr['shoppara_goodsparalist'] = $shoppara_goodsparalist;
	}
	
	// 获取列表参数
	$listattrwhere = "";
	if($listattrid)$listattrwhere = "and listattrid='".$listattrid."'";
	$wherelang = "";
	if($configinfo['lang'] && $langallok != 1)$wherelang = "and lang = '".$configinfo['lang']."'";
	$sql = "SELECT * FROM $table_modulepara_para_lists WHERE listid='".$dataid."' $modulewhere $listattrwhere $wherelang";
	$listsplist = $cjdb->getRow($sql);
	if(is_array($listsplist))
	{
		$getparaarr["lists"] = $listsplist;
	}
	
	// 默认文章模块时
	if($topmodule=="article")
	{
		// 获取栏目默认参数
		$sql = "SELECT * FROM $tablename WHERE $dataidname='".$dataid."'";
		$defplist = $cjdb->getRow($sql);
		foreach($defplist as $key=>$val)
		{
			if(ifstr($key,"type_") == 1)
			{
				// 参数类型为数组时转换为数组
				if(ifstr($key, "arrtype_") == 1)
				{
					$getparaarr['original_'.$key] = $val;// 原数组字符串数据
					$infoarr = getstrtoarr(",",$val);
					$getparaarr[$key] = $infoarr;
				}
				
				// 参数类型为JSON时转换为数组
				if(ifstr($key, "jsontype_") == 1)
				{
					$getparaarr['original_'.$key] = moduledatajoin($val);// 原JSON字符串数据
					$infoarr = getjsonarr($val);
					$getparaarr[$key] = $infoarr;
				}
				
				// 参数类型为DATE时格式化日期
				if(ifstr($key, "datetype_") == 1)
				{
					$getparaarr['original_'.$key] = $val;// 原JSON字符串数据
					$infoarr = date('Y-m-d',$val);
					$parameter_default['complete_'.$key] = date('Y-m-d H:i:s',$val);
					$getparaarr[$key] = $infoarr;
				}
			}
		}
		// 默认参数组JSON数组转换
		if($defplist['parameter'])
		{
			$datapraArr = getjsonarr($defplist['parameter']);
			foreach($datapraArr as $key=>$val)
			{
				$getparaarr[$key] = $val;
			}
		}
		
		// 详情页模块参数
		if(ifarray($paralist) && $phtmlok == 1)
		{
			// 重组模块参数HTML
			$paralisthtml = array();
			foreach($paralist as $key=>$val)
			{
				if($val['type'] <= 10)
				{
					if(!empty($val['pname']) && !empty($val['info']))
					{
						// 数组类型
						if(is_array($val['info']))
						{
							$val['info'] = getarrtostr(",",$val['info']);
						}
						
						// 图片类型
						if($val['type'] == 1)
						{
							$val['info'] = '<a href="'.$val['info'].'" target="_blank"><img src="'.$configinfo["incfileurl"].$val['info'].'" width="80" height="80" /></a>';
						}
						
						// 文件类型
						if($val['type'] == 2)
						{
							$val['info'] = '<a href="'.$configinfo['incfileurl'].$val['info'].'" target="_blank">'.$configlang["download_file"].'</a>';
						}
						
						// 链接类型
						if($val['type'] == 6)
						{
							$val['info'] = '<a href="'.$val['info'].'" target="_blank">'.$configlang["Click_Visit"].'</a>';
						}
						
						if($val['recok'] == 1)
						{
							$recparalisthtml[$key] = $val;
						}else{
							$defparalisthtml[$key] = $val;	
						}
						$paralisthtml[$key] = $val;		
					}
				}
			}
			
			// 推荐模块参数HTML列表
			if(ifarray($recparalisthtml))
			{
				$recparainfohtml = '<div class="st-block st-tableBlock parameterBlock">
									  <table>';
											foreach($recparalisthtml as $key=>$val)
											{
											  $recparainfohtml .= '<tr>
												<th width="30%">'.$val['pname'].'</th>
												<td width="70%">'.$val['info'].'</td>
											  </tr>';
											}
				$recparainfohtml .= '</table>
								 </div>';
			}
							 
			// 模块参数HTML列表
			if(ifarray($defparalisthtml))
			{
				$defparainfohtml = '<div class="st-block st-tableBlock parameterBlock">
									  <table>';
											foreach($defparalisthtml as $key=>$val)
											{
											  $defparainfohtml .= '<tr>
												<th width="30%">'.$val['pname'].'</th>
												<td width="70%">'.$val['info'].'</td>
											  </tr>';
											}
				$defparainfohtml .= '</table>
								 </div>';
			}
	
			// 模块参数HTML列表
			if(ifarray($paralisthtml))
			{
				$parainfohtml = '<div class="st-block st-tableBlock parameterBlock">
									  <table>';
											foreach($paralisthtml as $key=>$val)
											{
											  $parainfohtml .= '<tr>
												<th width="30%">'.$val['pname'].'</th>
												<td width="70%">'.$val['info'].'</td>
											  </tr>';
											}
				$parainfohtml .= '</table>
								 </div>';	
			}
		}
	}
	
	// 参数调用
	if($phtmlok == 1)
	{
		$resdata = array('paralist' => $paralisthtml, 'defparalist' => $defparalisthtml, 'recparalist' => $recparalisthtml, 'parahtml' => $parainfohtml,'defparahtml' => $defparainfohtml, 'recparahtml' => $recparainfohtml);	
	}else{
		$resdata = $getparaarr;		
	}
	
	return $resdata;
}

// 删除模块参数关联的数据
function deletemoduleparameter($dataid=0,$topid=0, $tablename = "", $dataidname = "",$module="article")
{
	global $lang;
	global $_MGPC_POST,$_MGPC_GET,$_MGPC_REQ,$_MGPC_COOKIE,$_MGPC_SESSION,$configlang,$configinfo,$configblock,$configcommon,$configmember,$configbase,$configsystem,$configindex,$configother;
	global $cjdb,$parameter_out;
	global $supplier_id;
	
	// 模块信息配置 DATE：2020-4-9 START
	$topmodule = $module;// 当前主模块
	$topid = !empty($topid) ? $topid : $configinfo['moduleid'];// 当前模块ID
	$topmoduleid = $topid;// 当前主模块ID
	$topmoduleinfo = columninfo($configinfo['ecs_article_cat'],$topmoduleid,$configinfo['cat_id']);
	// 模块信息配置 DATE：2020-4-9 END
	
	// 加载默认模块表
	$tablename = !empty($tablename) ? $tablename : $configinfo['ecs_article'];
	if(ifstr($tablename, $configinfo['ecs_article']) == 1)
	{
		$dataidname = !empty($dataidname) ? $dataidname : $configinfo['article_id'];
	}
	// 新增自定义模块独立表配置 DATE:2020-3-27 START
	if($topmodule=="article")
	{
		$moduletable = getmoduletable($topmoduleid);
		$topmodule_defaultmoduletable = gettopmodule("default","moduletable");
		if($moduletable != $topmodule_defaultmoduletable["tablename"])
		{
			$tablename = $moduletable;
		}
	}
	// 新增自定义模块独立表配置 DATE:2020-3-27 END
	
	// 新增重组模块参数表
	if($topmodule=="article")
	{
		$table_modulepara_para_list = "modulepara_para_list";
		$table_modulepara_para_lists = "modulepara_para_lists";
		$module=$module.$topid;
		// 新增自定义模块独立表配置 DATE:2020-3-27 START
		$moduleplist = getmoduleplist($topmoduleid);
		if($moduleplist != "article")
		{
			$table_modulepara_para_list = "modulepara_para_list_".$moduleplist;	
			$table_modulepara_para_lists = "modulepara_para_lists_".$moduleplist;	
		}
		// 新增自定义模块独立表配置 DATE:2020-3-27 END
	}else{
		$table_modulepara_para_list = "modulepara_para_list_".$module;	
		$table_modulepara_para_lists = "modulepara_para_lists_".$module;	
	}
	
	// 当前数据表
	$sql = "SELECT * FROM $tablename WHERE $dataidname=".$dataid;
	$defaultdata = $cjdb->getRow($sql);	
	
	// 商家操作数据权限（只允许操作自己的数据，限制非法操作其它商家的数据）
	// 支持所有模块商家权限判断
	if($supplier_id)
	{
		if($defaultdata['supplier_id'] != $supplier_id)
		{
			moduleerror(array("message"=>"Error:非法操作！商家只能操作自己的数据！"));
		}
	}
	
	// 会员操作数据权限（只允许操作自己的数据，限制非法操作其它会员的数据）
	// 支持所有模块会员权限判断
	if($configinfo['modulepara'] == 'pc' || $configinfo['modulepara'] == 'mobile' || $configinfo['modulepara'] == 'xcx')
	{
		if($configinfo['expmember_uid'] && $defaultdata['user_id'] != $configinfo['expmember_uid'])
		{
			moduleerror(array("message"=>"Error:非法操作！会员只能操作自己的数据！"));
		}
	}
	
	// 删除文件目录
	$fileurl = $configinfo['delfileurl'];
	
	// 默认文章模块时
	if($topmodule=="article")
	{
		// 新增栏目模块修改删除数据时限制操作当前模块条件 DATE:2020-12-17 START
		if(ifstr($tablename, $configinfo['ecs_article']) == 1)
		{
			// 模块操作数据权限（只允许操作当前模块的数据，限制非法操作其它模块的数据）
			if($defaultdata['module'] != $topmoduleid)
			{
				return array('error' => 1, 'message' => "不可操作其它模块下的数据或当前模块操作数据不存在，非法操作！");exit;	
			}
			
			// 模块操作数据where条件权限
			$modulewhere = getmodulewhere($topmoduleid);
			$plistmodulewhere = getmodulewhere($module);
		}
		// 新增栏目模块修改删除数据时限制操作当前模块条件 DATE:2020-12-17 END
		
		// 新增加载内容代码配置程序
		$moduledir = $supplier_id || $configinfo['modulepara'] != "admin" ? "configmodule" : "configmodulepara";
		if(iffile(MODULEPARA_PATH.'/configmodule/'.$moduledir.'/module/article/configdelete.php') == 1)
		{
			include(MODULEPARA_PATH.'/configmodule/'.$moduledir.'/module/article/configdelete.php');
		}
		if($configinfo['tplok'] == 1)
		{
			if(iffile($configinfo['tplurl'].'/configmodule/'.$moduledir.'/module/article/configdelete.php') == 1)
			{
				include($configinfo['tplurl'].'/configmodule/'.$moduledir.'/module/article/configdelete.php');
			}
		}
	}else{
		// 新增加载内容代码配置程序
		if(iffile(MODULEPARA_PATH.'/configmodule/configmodulepara/module/'.$topmodule.'/configdelete.php') == 1)
		{
			include(MODULEPARA_PATH.'/configmodule/configmodulepara/module/'.$topmodule.'/configdelete.php');
		}
		if($configinfo['tplok'] == 1)
		{
			if(iffile($configinfo['tplurl'].'/configmodule/configmodulepara/module/'.$topmodule.'/configdelete.php') == 1)
			{
				include($configinfo['tplurl'].'/configmodule/configmodulepara/module/'.$topmodule.'/configdelete.php');
			}
		}	
	}
	
	// 删除文件
	$sql = "SELECT * FROM $table_modulepara_para_list WHERE listid='".$dataid."' and module = '$module'";
	$plist = $cjdb->getAll($sql);
	foreach($plist as $key=>$val)
	{
		// 删除图片和其它文件
		if($val['type'] == 1 || $val['type'] == 2 || $val['type'] == 12)
		{
			unlink($fileurl.$val['info']);// 参数图片和参数文件
		}	
	}
	
	// 删除数据
	$sql = "DELETE FROM $table_modulepara_para_list WHERE listid = '".$dataid."' $plistmodulewhere";
	$cjdb->query($sql);
	$sql = "DELETE FROM $table_modulepara_para_lists WHERE listid = '".$dataid."' $plistmodulewhere";
	$cjdb->query($sql);
	
	// 默认文章模块时
	if($topmodule=="article")
	{
		// 删除文章默认表中的图片和文件
		$sql = "SELECT * FROM $tablename WHERE $dataidname = '$dataid'";
		$data = $cjdb->getRow($sql);
		foreach($data as $key=>$val)
		{
			if(ifstr($key,"type_") == 1)
			{				
				// 参数类型为图片时
				if(ifstr($data[$key],"imgtype_") == 1)
				{
					if($val)unlink($fileurl.$val);// 删除参数图片
				}
				
				// 参数类型为文件时
				if(ifstr($data[$key],"filetype_") == 1)
				{
					if($val)unlink($fileurl.$val);// 删除参数文件
				}
			}
		}
		// 删除文章默认表中的模块生成的缩略图
		if($data['img_thumb'])unlink($fileurl.$data['img_thumb']);// 图片缩略图
		if($data['img_big'])unlink($fileurl.$data['img_big']);// 图片大图
	}
}

// 获取当前栏目模块参数
function getcolumnattrparameter($columnid=0)
{
	global $configinfo;
	
	if($columnid)
	{
		$moduleclass = getparentclass($configinfo["ecs_article_cat"],$columnid,$configinfo['cat_id'],$configinfo['parent_id']);
	}else{
		$moduleclass = $configinfo['moduleclass'];
	}
	
	$attrdatalist1=getattrdatalist($configinfo['ecs_article'], $configinfo['article_id'], $configinfo['article_cat_id'], $configinfo['paramodule'], $moduleclass['class1'][$configinfo['cat_id']], 0, "", $configinfo['article_list_order']." asc");	
	$attrdatalist2=getattrdatalist($configinfo['ecs_article'], $configinfo['article_id'], $configinfo['article_cat_id'], $configinfo['paramodule'], $moduleclass['class2'][$configinfo['cat_id']], 0, "", $configinfo['article_list_order']." asc");	
	$attrdatalist3=getattrdatalist($configinfo['ecs_article'], $configinfo['article_id'], $configinfo['article_cat_id'], $configinfo['paramodule'], $moduleclass['class3'][$configinfo['cat_id']], 0, "", $configinfo['article_list_order']." asc");	
	
	$attrdatalist = "";
	if($attrdatalist1)
	{
		$attrdatalist = $attrdatalist1;
	}
	if($attrdatalist2)
	{
		$attrdatalist = $attrdatalist2;
	}
	if($attrdatalist3)
	{
		$attrdatalist = $attrdatalist3;
	}
	
	return $attrdatalist;
}

// 获取其它模块关联参数
function getotherattrparameter($otherparamodule='',$columnid=0)
{
	global $configinfo;
	
	if($columnid)
	{
		$moduleclass = getparentclass($configinfo["ecs_article_cat"],$columnid,$configinfo['cat_id'],$configinfo['parent_id']);
	}else{
		$moduleclass = $configinfo['moduleclass'];
	}
	
	$attrdatalist1=getattrdatalist($configinfo['ecs_article'], $configinfo['article_id'], $configinfo['article_cat_id'], $otherparamodule, $moduleclass['class1'][$configinfo['cat_id']], 0, "", $configinfo['article_list_order']." asc");	
	$attrdatalist2=getattrdatalist($configinfo['ecs_article'], $configinfo['article_id'], $configinfo['article_cat_id'], $otherparamodule, $moduleclass['class2'][$configinfo['cat_id']], 0, "", $configinfo['article_list_order']." asc");	
	$attrdatalist3=getattrdatalist($configinfo['ecs_article'], $configinfo['article_id'], $configinfo['article_cat_id'], $otherparamodule, $moduleclass['class3'][$configinfo['cat_id']], 0, "", $configinfo['article_list_order']." asc");	
	
	$attrdatalist = "";
	if($attrdatalist1)
	{
		$attrdatalist = $attrdatalist1;
	}
	if($attrdatalist2)
	{
		$attrdatalist = $attrdatalist2;
	}
	if($attrdatalist3)
	{
		$attrdatalist = $attrdatalist3;
	}
	
	return $attrdatalist;
}

// 后台自定义模块参数
function getcolumnparameter($parameter=array(),$topid=0,$outtopid=0,$outparaclassid=0)
{
	global $configinfo;
	
	$attrparameter = "";
	
	$attrdatalist=getcolumnattrparameter($outtopid);
	$classtypedata = getclasstypedata($topid,$outtopid);// 参数分类
	$classtypedata_data = $classtypedata['data'];
	
	// 遍历重组数组
	$attrdatalistsort = array();
	foreach($attrdatalist as $key=>$val)
	{
		$classtype = !empty($val['classtype']) ? $val['classtype'] : 0;
		$attrdatalistsort[$classtype]['title'] = $classtypedata_data[$classtype];
		$attrdatalistsort[$classtype]['data'][] = $val;
	}
	ksort($attrdatalistsort);// 数组正序排序
	
	// 外部配置栏目参数分类ID
	if($outparaclassid !== "all")
	{
		// 多参数分类配置
		if(is_array($outparaclassid))
		{
			foreach($outparaclassid as $key=>$val)
			{
				if($attrdatalistsort[$val])
				{
					$attrdatalistsortclass[$val] = $attrdatalistsort[$val];
				}
			}
		}else{
			if($attrdatalistsort[$outparaclassid])
			{
				$attrdatalistsortclass[$outparaclassid] = $attrdatalistsort[$outparaclassid];
			}	
		}
		$attrdatalistsort = $attrdatalistsortclass;
	}

	if(is_array($attrdatalistsort))
	{
		$data = array();
		$zdyparai = 0;
		foreach($attrdatalistsort as $sortkey=>$sortval)
		{
			if($classtypedata['def'] == 0)
			{
				$data['title'] = $sortval['title'];
				$attrparameter .= hook_getcolumnparameterclasshtml($data);// 分类参数标题HTML
			}
			foreach($sortval['data'] as $key=>$val)
			{
				if($val['type'] == 4 || $val['type'] == 6)
				{
					$zdyparai++;
					$val['i'] = $zdyparai;
				}
				$attrparameter .= getcolumnparameterhtml($val,$parameter);// 栏目参数
			}
		}
		if($classtypedata['def'] == 0)
		{
			$attrparameter .= hook_getcolumnparameterclasshtml(array('endok'=>1));// 分类参数标题HTML
		}
	}
	
	return $attrparameter;
}

// 后台自定义模块参数html
function getcolumnparameterhtml($data=array(),$parameter=array())
{
	global $configinfo;
	global $supplier_id;
	
	// 获取商家配置模块栏目参数信息
	$dataarr['supplier'] = 0;
	if($supplier_id)
	{
		$dataarr['supplier'] = 1;
	}
	
	$dataarr['id'] = $data["attrvar"];// ID
	$dataarr['attrid'] = $data["attrvar"]."|".$data[$configinfo['article_id']];// 关联ID
	$dataarr['type'] = $data['type'];// 类型
	$dataarr['paratip'] = $data['paratip'];// 参数提示
	$dataarr['codeqz'] = $data['codeqz'];// 验证规则
	$dataarr['inputtype'] = $data['inputtype'];// 表单类型
	$dataarr['title'] = $data[$configinfo['title']];// 标题
	$dataarr['value'] = $parameter[$dataarr['id']];// 值
	
	// 推荐
	$dataarr['reckey'] = "";
	if($data['recok'] == 1 && $dataarr['type'] != 4 && $dataarr['type'] != 6)
	{
		$dataarr['reckey'] = "recpara_";	
	}
	
	// 附件
	if($dataarr['type'] == 4 || $dataarr['type'] == 6)
	{
		$dataarr['i'] = $data['i'] - 1;// 键i
		
		if($dataarr['type'] == 4)$dataarr['typename'] = "filetype_";
		if($dataarr['type'] == 6)$dataarr['typename'] = "imgtype_";
		$dataarr['filevalue'] = $parameter[$dataarr['id']];// 值
	}
	
	// 多选
	if($dataarr['type'] == 3)
	{
		$dataarr['typename'] = "arrtype_";
	}
	
	// 选择
	if($dataarr['type'] == 1 || $dataarr['type'] == 3 || $dataarr['type'] == 5)
	{
		$attrinfo = getstrtoarr(",",$data['attrinfo']);
		foreach($attrinfo as $key=>$val)
		{
			$attrdata[$key]['id'] = $key;
			$attrdata[$key]['info'] = $val;
			
			// 下拉
			if($dataarr['type'] == 1)
			{
				if($dataarr['value'] == $val)
				{
					$attrdata[$key]['select'] = "selected";	
				}else{
					$attrdata[$key]['select'] = "";		
				}
			}
				
			// 多选
			if($dataarr['type'] == 3)
			{
				if(in_array($val, $dataarr['value']))
				{
					$attrdata[$key]['select'] = "checked";	
				}else{
					$attrdata[$key]['select'] = "";		
				}
			}
				
			// 单选
			if($dataarr['type'] == 5)
			{
				if($dataarr['value'] == $val)
				{
					$attrdata[$key]['select'] = "checked";	
				}else{
					$attrdata[$key]['select'] = "";		
				}
			}
		}
		$dataarr['attrinfo'] = $attrdata;
	}
	
	$dataarr['condition'] = $data['condition'];// 是否必选

	$parahtml = hook_getcolumnparameterhtml($dataarr);
	
	return $parahtml;
}

// 后台商品模块参数
function getadminshopparameter($parameter=array(),$parameter_other=array())
{
	global $configinfo,$configlang;
		
	$shopdatalist=$configinfo['shopadminparameter'];
	
	// 商品参数html
	$shopparameterhtml = "";
	if(is_array($shopdatalist))
	{
		$shopdataarr = array();
		foreach($shopdatalist as $key=>$val)
		{
			$shopdataarr[$key]['id'] = $val[$configinfo['article_id']];
			$shopdataarr[$key]['title'] = $val[$configinfo['title']];
			
			// 参数选项列表
			$attrshpparalist=getattrdatalist($configinfo['ecs_article'], $configinfo['article_id'], $configinfo['article_cat_id'], $configinfo['shopparalistmodule'], $val[$configinfo['cat_id']]);	
			$attrshpparalistarr = array();
			foreach($attrshpparalist as $key2=>$val2)
			{
				$attrshpparalistarr[$key2]['id'] = $val2[$configinfo['article_id']];
				$attrshpparalistarr[$key2]['title'] = $val2[$configinfo['title']];
				// 已选择商品参数列表
				if($parameter)
				{
					foreach($parameter['shoppara_checkpara'] as $checkkey=>$chceckval)
					{
						foreach($chceckval as $checkkey2=>$chceckval2)
						{
							if($chceckval2 == $val2[$configinfo['article_id']])
							{
								$attrshpparalistarr[$key2]['checkok'] = "checked";	
							}
						}
					}
				}
			}
			$shopdataarr[$key]['attrlist'] = $attrshpparalistarr;
		}
		
		// 商品已设置订购规格参数
		$otherdata['goodsparameter'] = $parameter_other['goodsparameter'];
		
		$shopparameterhtml = hook_getadminshopparameterhtml($shopdataarr,$otherdata);	
	}
	
	return $shopparameterhtml;
}

// 获取栏目搜索参数
function getsearchparameter($type=0)
{
	global $configinfo,$configlang;
		
	$searchdatalist=$configinfo['columnparameter'];
	
	// 搜索参数html
	$searchparameter = "";
	foreach($searchdatalist as $key=>$val)
	{
		if($val['searchok'] == 1 && ($val['type'] == 1 || $val['type'] == 3 || $val['type'] == 5 || $val['type'] == 7))
		{
			if($type == 0)$searchparameter .= getsearchparameterhtml($val);	
			if($type == 1)$searchparameter .= getsearchparameterhtml2($val);	
		}
	}
	
	if($type == 0)
	{
		$searchparameterhtml = $searchparameter;
		if(is_array($configinfo['searchselectpara']) && count($configinfo['searchselectpara']) > 0)
		{
			$searchparameterhtml .= '<dl>
										  <dt>'.$configlang['Selected_conditions'].'</dt>
										  <dd>';
					foreach($configinfo['searchselectpara'] as $key=>$val)
					{
						// 当为数字参数时
						if(is_array($val))
						{
							$kval = $val['kname'].$val['kval'];
							$val = $val['kval'];
						}
						// URL 单选与多选URL格式化
						$searchurl = getsearchurl("s-".$key, $kval);
						$url = $searchurl;// 获取栏目搜索参数URL
						$searchparameterhtml .= '<span class="sellist" onclick="location.href=\''.$url.'\';">'.$val.'<span>X</span></span>';
					}
				 $searchparameterhtml .= '</dd>
										</dl>';
		}
	}else{
		$searchparameterhtml = "<style>.st-searchparameter2 *{ margin:0; padding0; line-height:1.8;}.st-searchparameter2{ border:1px solid #d2d2d2; border-bottom:none; background:#f5f5f5;}
		.st-searchparameter2 dl{ border-bottom:1px solid #d2d2d2; float:left; width:100%;}.st-searchparameter2 dl dt{ float:left; width:10%; text-align:right; padding:5px; margin-top:2px;}
		.st-searchparameter2 dl dd{ padding:5px; border-left:1px solid #d2d2d2; background:#eee; width:90%; float:left;}
		.st-searchparameter2 dl.numberpara dd input{ border:1px solid #d2d2d2; width:120px; line-height:1.8; padding-left:5px;}</style>".$searchparameter;
	}
	
	if(empty($searchparameter))
	{
		$searchparameterhtml = "<style>.st-searchparameter,.st-searchparameter2{display:none;}</style>";
	}
	
	return $searchparameterhtml;
}

// 获取条件搜索栏目
function getsearchparameterwhere($prefix='',$thinkphpok=0)
{
	global $configinfo;
	
	$searchparameterlist = $configinfo['searchparameterlist'];
	$filter = $searchparameterlist['searchlist'];// 获取栏目搜索参数组
	foreach($filter as $key=>$val)
	{
		$getparameter[$key] = $val;
	}
	
	$parawhere = parametersearch($getparameter,2,$prefix,$thinkphpok);
	
	return $parawhere;
}

// 获取数量搜索排序
function getnumberorderwhere($thinkphpok=0)
{
	$numberorder = moduleaqvarval('so','string');
	if($numberorder)
	{
		$numberorderdata = getstrtoarr("|",$numberorder);
		$paraid = $numberorderdata[0];
		$info = $numberorderdata[1];
		
		$filter[$paraid] = $info;
		if($info == "desc")$orderby = "desc";
		if($info == "asc")$orderby = "asc";
		if($thinkphpok == 1)
		{
			$where["plist.paraid"] = $paraid;
			$order["plist.info"] = $orderby;
		}else{
			$where = "and plist.paraid = '".$paraid."'";
			$order = "plist.info $orderby";	
		}
	}
	
	return array("where" => $where, "order" => $order, "filter" => $filter);
}

// 获取后台条件搜索栏目
function getsearchparameterwhere2($prefix='',$thinkphpok=0)
{
	global $configinfo;
	
	$searchparadata = moduleaqvarval('searchpara','array');// 搜索数据	
	foreach($searchparadata as $key=>$val)
	{
		if($val)$getparameter[$key] = $val;
	}
	
	$parawhere = parametersearch($getparameter,2,$prefix,$thinkphpok);
	
	return $parawhere;
}

// 获取搜索已选参数
function getsearchselectpara()
{
	$thisurl = urldecode($_SERVER['REQUEST_URI']);// 当前URL
	$thisurlarr = getstrtoarr("?",$thisurl);
	$lefturl = $thisurlarr[0];
	$righturl = $thisurlarr[1];
	
	if($righturl)
	{
		$paraurlarr = getstrtoarr("&",$righturl);
		$selectparagroup = array();
		foreach($paraurlarr as $key=>$val)
		{
			$parainfo = getstrtoarr("=",$val);
			if(ifstr($parainfo[0],"s-") == 1)
			{
				$selectparagroup[] = $val;
			}
		}
	}
	
	if(count($selectparagroup) > 0)
	{
		$selectparagroupnew = array();
		foreach($selectparagroup as $key=>$val)
		{
			$parainfo = getstrtoarr("=",$val);
			$paraname = delthstr($parainfo[0],"s-","");
			$paraval = $parainfo[1];
			if(ifstr($parainfo[1],"sn|") == 1)
			{
				$paraval = array();
				$paraval['kname'] = "sn|";
				$paraval['kval'] = delthstr($parainfo[1],"sn|","");
			}
			$selectparagroupnew[$paraname] = $paraval;
		}
	}
	
	return $selectparagroupnew;
}

// 获取搜索参数URL
function getsearchurl($paraid="", $info="", $type=0)
{
	global $configinfo;
	
	$thisurl = urldecode($_SERVER['REQUEST_URI']);// 当前URL
	$thisurlarr = getstrtoarr("?",$thisurl);
	$lefturl = $thisurlarr[0];
	$righturl = $thisurlarr[1];
	
	if(empty($righturl))
	{
		$paraurl = "sp=1";
	}else{
		if(ifstr($righturl, "sp=1") == 0)
		{
			$paraurl = "sp=1&";
		}
	}
	
	$url = "";
	if($paraid && $info)
	{
		if($type==2)
		{
			foreach($paraid as $key=>$val)
			{
				$url .= "&".$val."=".$info[$key];
			}
		}else{
			$url = "&".$paraid."=".$info;// 搜索参数URL
		}
	}
	if($righturl)
	{
		$paraurlarr = getstrtoarr("&",$righturl);
		$thisurlpara = "";
		foreach($paraurlarr as $key=>$val)
		{
			$parainfo = getstrtoarr("=",$val);
			if($type==2)
			{
				foreach($paraid as $pk=>$pv)
				{
					if($parainfo[0] == $pv)
					{
						$thisurlpara[] = "&".$val;// 已存在参数URL
					}
				}
			}else{
				if($parainfo[0] == $paraid)
				{
					$thisurlpara = "&".$val;// 已存在参数URL
					$thisurlinfo = $parainfo[1];// 已存在参数值
				}
			}
		}
	}
	
	if($type==2)
	{
		if(is_array($thisurlpara))
		{
			foreach($thisurlpara as $key=>$val)
			{
				$righturl = delthstr($righturl,$val,"");		
			}
		}
		$paraurl .= $righturl;
		$paraurl .= $url;	
	}else{
		if($thisurlpara)
		{
			$paraurl .= delthstr($righturl,$thisurlpara,"");	
			
			// 多选
			if($type == 1)
			{
				$thisurlinfoarr = getstrtoarr(",",$thisurlinfo);
				if(ifarraystr($thisurlinfoarr,$info) == 1)
				{
					foreach($thisurlinfoarr as $key => $val)
					{
						if($val == $info)
						{
							unset($thisurlinfoarr[$key]);	
						}
					}
					
					$thisurlinfo = getarrtostr(",",$thisurlinfoarr);
					if($thisurlinfo)$duourl = "&".$paraid."=".$thisurlinfo;// 搜索参数URL
				}else{
					$duourl = "&".$paraid."=".$thisurlinfo.",".$info;// 搜索参数URL	
				}
				$paraurl .= $duourl;
			}else{
				if($url != $thisurlpara)
				{
					$paraurl .= $url;
				}
			}
		}else{
			$paraurl .= $righturl;
			$paraurl .= $url;
		}
	}
	
	$newurl = $lefturl."?".$paraurl;
	
	return $newurl;
}

// 获取栏目搜索参数列表
function getsearchparameterlist($id=0, $info="", $duook=0, $duoi=0)
{
	global $configinfo;
	
	// 搜索参数URL开启时
	$searchlist = array();
	$searchparaok = moduleaqvarval('sp','intval');
	if($searchparaok == 1)
	{
		// 搜索参数列表
		$searchdatalist=$configinfo['columnparameter'];
		foreach($searchdatalist as $key=>$val)
		{
			// 开启搜索参数时
			if($val['searchok'] == 1 && ($val['type'] == 1 || $val['type'] == 3 || $val['type'] == 5 || $val['type'] == 7))
			{
				$sp_id = $val['attrvar'];
				$searchparaid = moduleaqvarval('s-'.$sp_id,'string');
				if($searchparaid)
				{
					// 多选
					if($val['type'] == 3)
					{
						$searchparaid = getstrtoarr(",",$searchparaid);
					}
					$searchlist[$sp_id]	= $searchparaid;	
				}	
			}
		}
	}
	
	return array('searchlist' => $searchlist);
}

// 栏目搜索参数搜索html
function getsearchparameterhtml($data=array())
{
	global $configinfo,$configlang;
	
	$dataarr['id'] = $data['attrvar'];// ID
	$dataarr['type'] = $data['type'];// 类型
	$dataarr['title'] = $data[$configinfo['title']];// 标题
	
	// 选择
	if($dataarr['type'] == 1 || $dataarr['type'] == 3 || $dataarr['type'] == 5 || $dataarr['type'] == 7)
	{
		$attrinfo = getstrtoarr(",",$data['attrinfo']);
		
		// 数字条件搜索框筛选
		if($dataarr['type'] == 7)
		{
			// 已筛选的信息
			$searchparaid = moduleaqvarval('s-'.$dataarr['id'],'string');
			
			// 获取筛选URL
			$searchurl = getsearchurl("s-".$dataarr['id'], $searchparaid);
			$dataarr['url'] = $searchurl;
			$dataarr['searchurl'] = "&s-".$dataarr['id']."=sn|";
			
			// 获取已筛选信息
			if($searchparaid)
			{
				$numberpara = delthstr($searchparaid,"sn|","");
				$numberselect = getstrtoarr("-",$numberpara);
				$dataarr['minnumber'] = $numberselect[0];
				$dataarr['maxnumber'] = $numberselect[1];
			}else{
				$dataarr['minnumber'] = "";
				$dataarr['maxnumber'] = "";	
			}
			
			// 排序URL
			$dataarr['orderurl_desc'] = getsearchurl("so", $dataarr['id']."|desc");
			$dataarr['orderurl_asc'] = getsearchurl("so", $dataarr['id']."|asc");
			$numberorder = moduleaqvarval('so','string');
			$numberorderdata = getstrtoarr("|",$numberorder);
			$dataarr['orderselect_desc'] = $numberorderdata[0] == $dataarr['id'] && $numberorderdata[1] == "desc" ? 1 : 0;
			$dataarr['orderselect_asc'] = $numberorderdata[0] == $dataarr['id'] && $numberorderdata[1] == "asc" ? 1 : 0;
		}
		
		foreach($attrinfo as $key=>$val)
		{
			$attrdata[$key]['info'] = $val;
			
			// 数字参数
			if($dataarr['type'] == 7)
			{
				$info = getstrtoarr("-",$val);
				$attrdata[$key]['infomin'] = $info[0];
				$attrdata[$key]['infomax'] = $info[1];
				$val = "sn|".$val;
			}
			
			// URL 单选与多选URL格式化
			if($dataarr['type'] == 3)
			{
				$searchurl = getsearchurl("s-".$dataarr['id'], $val, 1);
			}else{
				$searchurl = getsearchurl("s-".$dataarr['id'], $val);
			}
			$url = $searchurl;// 获取栏目搜索参数URL
			$attrdata[$key]['url'] = $url;
			
			// 选中
			if($dataarr['type'] == 3)
			{
				$searchparaid = moduleaqvarval('s-'.$dataarr['id'],'string');
				$searchparaidarr = getstrtoarr(",",$searchparaid);
				if(ifarraystr($searchparaidarr,$val) == 1)
				{
					$attrdata[$key]['select'] = 1;
				}else{
					$attrdata[$key]['select'] = 0;	
				}
			}else{
				$searchparaid = moduleaqvarval('s-'.$dataarr['id'],'string');
				if($searchparaid == $val)
				{
					$attrdata[$key]['select'] = 1;
				}else{
					$attrdata[$key]['select'] = 0;	
				}	
			}
		}
		$dataarr['attrinfo'] = $attrdata;
	}

	$parahtml = hook_getsearchparameterhtml($dataarr,$configlang);
	
	return $parahtml;
}

// 后台栏目搜索参数搜索html
function getsearchparameterhtml2($data=array())
{
	global $configinfo;
	
	$dataarr['id'] = $data['attrvar'];// ID
	$dataarr['type'] = $data['type'];// 类型
	$dataarr['title'] = $data[$configinfo['title']];// 标题
	$searchparadata = moduleaqvarval('searchpara','array');// 搜索数据
	
	// 选择
	if($dataarr['type'] == 1 || $dataarr['type'] == 3 || $dataarr['type'] == 5 || $dataarr['type'] == 7)
	{
		// 数字条件搜索框筛选
		if($dataarr['type'] == 7)
		{
			// 已筛选的信息
			$searchparaid1 = $searchparadata[$dataarr['id']]['sn|0'];
			$searchparaid2 = $searchparadata[$dataarr['id']]['sn|1'];
			
			// 获取已筛选信息
			if($searchparaid1)
			{
				$dataarr['minnumber'] = $searchparaid1;
			}else{
				$dataarr['minnumber'] = "";
			}
			if($searchparaid2)
			{
				$dataarr['maxnumber'] = $searchparaid2;
			}else{
				$dataarr['maxnumber'] = "";	
			}
			
		}
		
		$attrinfo = getstrtoarr(",",$data['attrinfo']);
		foreach($attrinfo as $key=>$val)
		{
			$attrdata[$key]['id'] = $key;
			$attrdata[$key]['info'] = $val;
			
			// 下拉
			if($dataarr['type'] == 1)
			{
				if($searchparadata[$dataarr['id']] == $val)
				{
					$attrdata[$key]['select'] = "selected";	
				}else{
					$attrdata[$key]['select'] = "";		
				}
			}
			
			// 多选
			if($dataarr['type'] == 3)
			{
				
				if($searchparadata[$dataarr['id']][$key] == $val)
				{
					$attrdata[$key]['select'] = "checked";	
				}else{
					$attrdata[$key]['select'] = 0;	
				}
			}
			
			// 单选
			if($dataarr['type'] == 5)
			{
				if($searchparadata[$dataarr['id']] == $val)
				{
					$attrdata[$key]['select'] = "checked";	
				}else{
					$attrdata[$key]['select'] = "";		
				}
			}
		}
		$dataarr['attrinfo'] = $attrdata;
	}

	$parahtml = hook_getsearchparameterhtml2($dataarr);
	
	return $parahtml;
}

// 数据列表插入
// 使用方法：insertdata($tablename);
function insertdata($tablename = "", $data=array())
{
	global $cjdb;

	$insertdata_key="";$insertdata_val="";
	foreach($data as $key=>$val)
	{
		$aqkey = moduleaqvarval($key, "string", "data");
		$insertdata_key .= ",`$aqkey`";
		$insertdata_val .= ",'$val'";
	}
	$insertdata_key = substr($insertdata_key, 1);
	$insertdata_val = substr($insertdata_val, 1);
		
	$sql = "INSERT INTO $tablename (".$insertdata_key.") ". "VALUES (".$insertdata_val.")";
	$cjdb->query($sql);
	$insert_id = $cjdb->getInsertid();
	
	return $insert_id;	
}

// 修改数据
function updatedata($tablename = "", $data="", $dataidname='', $dataid=0, $where="", $fielddata="")
{
	global $cjdb,$configinfo;
	$globalconfig = $configinfo['fun_updatedata'];
	
	// 新增默认条件开启 DATE:2020-6-12 START
	$defaultwhereok = $dataidname && $dataid ? 1 : 0;
	// 新增默认条件开启 DATE:2020-6-12 END
		
	$updatedata = "";
	if(is_array($data))
	{
		foreach($data as $key=>$val)
		{
			$aqkey = moduleaqvarval($key, "string", "data");
			$updatedata .= ",`$aqkey`='$val'";
		}
		$updatedata = substr($updatedata, 1);
	}else{
		$updatedata = $data;
	}
	
	if($updatedata && $fielddata)$fielddata = ",".$fielddata;
	$defaultwhere="";
	if($defaultwhereok)$defaultwhere = "and $dataidname = '".$dataid."'";
	
	// 新增栏目模块修改删除数据时限制操作当前模块条件 DATE:2020-12-17 START
	if(ifstr($tablename, $configinfo['ecs_article']) == 1)
	{
		$moduleid = $globalconfig['moduleid'] ? $globalconfig['moduleid'] : $configinfo['moduleid'];
		$defaultwhere .= getmodulewhere($moduleid);	
	}
	// 新增栏目模块修改删除数据时限制操作当前模块条件 DATE:2020-12-17 END
	
	$wheresql="";
	if($where)$wheresql = "and ".$where;
	if($defaultwhere || $wheresql)
	{
		$sql = "UPDATE $tablename SET $updatedata $fielddata". " WHERE 1=1 $defaultwhere $wheresql";
		$res = $cjdb->query($sql);
		$total = $cjdb->getTotal();
		
		$updateok=0;
		if($total == true)
		{
			$updateok=1;
		}
		return $updateok;
	}else{
		return array('error' => 1, 'message' => "操作数据条件不可以为空，必需要设置条件，避免导致所有数据被删除的风险，在正式网站中造成不可挽回的损失！");exit;
	}
}

// 修改参数数据

// 用户修改相关价格访问数量等参数信息前台的变动
// updateparadata(array("other1"=>"testupdate"), 22, "");
// updateparadata(array("other1"=>"setdata+10"), 22, "");
function updateparadata($data=array(), $dataid=0, $parawhere="", $topid=0, $columnid=0, $autoinsert=0, $autoconfig=array(), $module="article")
{
	global $cjdb,$configinfo;
	
	$topmodule = $module;// 当前主模块
	$topid = $topid ? $topid : $configinfo['moduleid'];// 模块ID
	$columnid = $columnid ? $columnid : $configinfo['columnid'];// 栏目ID
	$defaultwhere = $dataid ? "listid = '".$dataid."' AND" : "";
	$parawhere = !empty($parawhere) ? "and ".$parawhere : "";// 参数条件设置
	
	if($topmodule=="article")
	{
		$table_modulepara_para_list = "modulepara_para_list";
		
		// 新增栏目模块修改删除数据时限制操作当前模块条件 DATE:2020-12-17 START
		$module=$module.$topid;
		$modulewhere = getmodulewhere($module);	
		// 新增栏目模块修改删除数据时限制操作当前模块条件 DATE:2020-12-17 END
		
		// 新增自定义模块独立表配置 DATE:2020-3-27 START
		$moduleplist = getmoduleplist($topid);
		if($moduleplist != "article")
		{
			$table_modulepara_para_list = "modulepara_para_list_".$moduleplist;	
		}
		// 新增自定义模块独立表配置 DATE:2020-3-27 END
	}else{
		$table_modulepara_para_list = "modulepara_para_list_".$module;	
	}
	
	if($defaultwhere || $parawhere || $modulewhere)
	{
		// 开启参数为空时自动插入参数数据
		if($autoinsert == 1)
		{
			$datakey = key($data);
			$dataval = current($data);
			$autoconfig['type'] = $autoconfig['type'] ? $autoconfig['type'] : 0;
			$autoconfig['systemok'] = $autoconfig['systemok'] ? $autoconfig['systemok'] : 0;
			$sql = "SELECT paraid FROM $table_modulepara_para_list WHERE $defaultwhere paraid = '$datakey' $parawhere $modulewhere";
			$plist = $cjdb->getRow($sql);
			if(empty($plist))
			{
				// 参数字段类型设置-------------------------------------------------------------START
				
				// 小型整数参数
				$tintparaVal = 0;
				if(strpos($datakey,"tintpara_") !== false)
				{
					$datakey = delthstr($datakey,"tintpara_","");// 删除参数前缀
					$tintparaVal = $dataval;
					$dataval = "";
				}
				
				// 整数参数
				$intparaVal = 0;
				if(strpos($datakey,"intpara_") !== false)
				{
					$datakey = delthstr($datakey,"intpara_","");// 删除参数前缀
					$intparaVal = $dataval;
					$dataval = "";
				}
				
				// 小数参数
				$decparaVal = 0;
				if(strpos($datakey,"decpara_") !== false)
				{
					$datakey = delthstr($datakey,"decpara_","");// 删除参数前缀
					$decparaVal = $dataval;
					$dataval = "";
				}
				
				// 文本参数
				$textparaVal = "";
				if(strpos($datakey,"textpara_") !== false)
				{
					$datakey = delthstr($datakey,"textpara_","");// 删除参数前缀
					$textparaVal = $dataval;
					$dataval = "";
				}
				
				// 参数字段类型设置-------------------------------------------------------------END
			
				$sql = "INSERT INTO $table_modulepara_para_list (listid, paraid, info, tintpara, intpara, decpara, textpara, type, classid, module, systemok, lang) ". "VALUES ('".$dataid."', '".$datakey."', '".$dataval."', '".$tintparaVal."', '".$intparaVal."', '".$decparaVal."', '".$textparaVal."', '".$autoconfig['type']."', '".$columnid."', '$module', '".$autoconfig['systemok']."', '".$configinfo['lang']."')";
				$cjdb->query($sql);
				
				return true;
			}
		}
	
		foreach($data as $key=>$val)
		{			
			// 修改参数设置默认参数
			$setVal = "info = '".$val."'";
			$setData = "";
			
			// 参数字段类型设置-------------------------------------------------------------START
			
			// 小型整数参数
			if(strpos($key,"tintpara_") !== false)
			{
				$setVal = "tintpara = '".$val."'";
			}
			
			// 整数参数
			if(strpos($key,"intpara_") !== false)
			{
				$setVal = "intpara = '".$val."'";
				$setData = "`intpara` = `intpara`";
			}
			
			// 小数参数
			if(strpos($key,"decpara_") !== false)
			{
				$setVal = "decpara = '".$val."'";
				$setData = "`decpara` = `decpara`";
			}
			
			// 文本参数
			if(strpos($key,"textpara_") !== false)
			{
				$setVal = "textpara = '".$val."'";
			}
			
			// 参数字段类型设置-------------------------------------------------------------END
				
			$updatedata = $setVal;
			if(strpos($val,"setdata") !== false && $setData)
			{
				$fielddata=str_replace("setdata","",$val);	
				$updatedata = "$setData $fielddata";
			}
			$sql = "UPDATE $table_modulepara_para_list SET $updatedata". " WHERE $defaultwhere paraid = '$key' $parawhere $modulewhere";
			$cjdb->query($sql);
		}
	}else{
		return array('error' => 1, 'message' => "操作数据条件不可以为空，必需要设置条件，避免导致所有数据被删除的风险，在正式网站中造成不可挽回的损失！");exit;
	}	
}

// 删除数据
function deletedata($tablename = "", $dataidname='', $dataid=0, $where = "")
{
	global $cjdb,$configinfo;
	$globalconfig = $configinfo['fun_deletedata'];
	
	// 新增默认条件开启 DATE:2020-6-12 START
	$defaultwhereok = $dataidname && $dataid ? 1 : 0;
	// 新增默认条件开启 DATE:2020-6-12 END
	
	$defaultwhere="";
	if($defaultwhereok)$defaultwhere = "and $dataidname = '".$dataid."'";
	
	// 新增栏目模块修改删除数据时限制操作当前模块条件 DATE:2020-12-17 START
	if(ifstr($tablename, $configinfo['ecs_article']) == 1)
	{
		$moduleid = $globalconfig['moduleid'] ? $globalconfig['moduleid'] : $configinfo['moduleid'];
		$defaultwhere .= getmodulewhere($moduleid);	
	}
	// 新增栏目模块修改删除数据时限制操作当前模块条件 DATE:2020-12-17 END
	
	$wheresql="";
	if($where)$wheresql = "and ".$where;
	if($defaultwhere || $wheresql)
	{
		$sql = "DELETE FROM $tablename WHERE 1=1 $defaultwhere $wheresql";
		$cjdb->query($sql);
		$total = $cjdb->getTotal();	
		
		$deleteok=0;
		if($total == true)
		{
			$deleteok=1;
		}
		return $deleteok;
	}else{
		return array('error' => 1, 'message' => "操作数据条件不可以为空，必需要设置条件，避免导致所有数据被删除的风险，在正式网站中造成不可挽回的损失！");exit;
	}	
}

// 获取关联列表参数
function getattrparameter($listid=0,$listattrid=0)
{
	global $cjdb,$lang;
	
	$wherelang = "";
	if($lang)$wherelang = "and lang = '$lang'";
	$sql = "SELECT * FROM modulepara_para_list WHERE listid = '$listid' and listattrid = '$listattrid' $wherelang";
	$plist = $cjdb->getAll($sql);
	foreach($plist as $key=>$val)
	{
		$arr[$val['paraid']] = $val['info'];
	}
	
	return $arr;	
}

// 获取自定义关联栏目参数信息
function getattrparameterinfo($attrparaid=0)
{
	global $configinfo,$cjdb;
	
	$sql = "SELECT * FROM ".$configinfo['ecs_article']." WHERE ".$configinfo['article_id']."='".$attrparaid."'";
	$attrparainfo = $cjdb->getRow($sql);
	
	$parainfo['name'] = $attrparainfo[$configinfo['title']];
	$attrparaplist = getmoduleparameter($attrparainfo[$configinfo['article_id']]);
	if($attrparaplist)$parainfo += $attrparaplist;
	
	return $parainfo;
}

// 将数据转换成参数条件
function parametersearch($data=array(),$type=0,$prefix="",$thinkphpok=0)
{
	global $configinfo,$cjdb;
	
	$table_modulepara_para_list = "modulepara_para_list";
	if($configinfo['moduleid'])
	{
		// 新增自定义模块独立表配置 DATE:2020-3-27 START
		$moduleplist = getmoduleplist($configinfo['moduleid']);
		if($moduleplist != "article")
		{
			$table_modulepara_para_list = "modulepara_para_list_".$moduleplist;	
		}
		// 新增自定义模块独立表配置 DATE:2020-3-27 END
	}
	
	if($configinfo['moduleid'])
	{
		$module = "article".$configinfo['moduleid'];
	}
	
	$where = "";
	if($thinkphpok == 1)$where = array();
	$filter = array();
	
	if($type==1)
	{
		foreach($data as $key=>$val)
		{
			if(is_array($val))
			{
				if(ifarray($val) == 0)
				{
					$val = "";
				}
			}
			if($val)
			{
				$filter[$key] = $val;
				
				// 数字区间
				if(is_array($val))
				{
					if($val['sn|0'] || $val['sn|1'])
					{
						$val = "sn|".$val['sn|0']."-".$val['sn|1'];
					}
				}
				
				// 多选
				if(is_array($val))
				{						
					if($thinkphpok == 1)
					{
						foreach($val as $k=>$v)
						{
							if($v)$where[$prefix.$key][] = array('LIKE',"%".$v. "%");
						}
					}else{
						foreach($val as $k=>$v)
						{
							if($v)$where .= "AND {$prefix}$key like '%".$v."%' ";	
						}
					}
				
				// 单选
				}else{
					// 数字区间筛选
					if(strpos($val,"sn|") !== false)
					{
						$numberpara = delthstr($val,"sn|","");
						$numberwhere = getstrtoarr("-",$numberpara);
						$minnumber = moduleaqvarval($numberwhere[0], 'intval', 'data');
						$maxnumber = moduleaqvarval($numberwhere[1], 'intval', 'data');
						if($thinkphpok == 1)
						{
							if($minnumber)$where[$prefix.$key][] = array('ELT',"%".$minnumber. "%");
							if($maxnumber)$where[$prefix.$key][] = array('EGT',"%".$maxnumber. "%");
						}else{
							if($minnumber)$where .= "AND {$prefix}$key >= '".$minnumber."' ";	
							if($maxnumber)$where .= "AND {$prefix}$key <= '".$maxnumber."' ";	
						}
					}else{
						if($thinkphpok == 1)
						{
							if($val)$where[$prefix.$key] = array('LIKE',"%".$val. "%");
						}else{
							if($val)$where .= "AND {$prefix}$key like '%".$val."%' ";	
						}
					}
				}
			}
		}
	}
	
	if($type==2)
	{
		$paraidi=0;
		$paraidStr = array();
		foreach($data as $key=>$val)
		{
			if(is_array($val))
			{
				if(ifarray($val) == 0)
				{
					$val = "";
				}
			}
			if($val)
			{
				$filter[$key] = $val;
				
				// 数字区间
				if(is_array($val))
				{
					if($val['sn|0'] || $val['sn|1'])
					{
						$val = "sn|".$val['sn|0']."-".$val['sn|1'];
					}
				}
				
				// 多选
				if(is_array($val))
				{
					$infowhere = "";
					foreach($val as $k=>$v)
					{
						if($v)$infowhere .= "and info like '%".$v."%' ";
					}
				
				// 单选
				}else{
					// 数字区间筛选
					if(strpos($val,"sn|") !== false)
					{
						$numberpara = delthstr($val,"sn|","");
						$numberwhere = getstrtoarr("-",$numberpara);
						$minnumber = moduleaqvarval($numberwhere[0], 'intval', 'data');
						$maxnumber = moduleaqvarval($numberwhere[1], 'intval', 'data');
						$infowhere = "";
						if($minnumber)$infowhere .= "and info >= ".$minnumber." ";
						if($maxnumber)$infowhere .= "and info <= ".$maxnumber." ";
						
					}else{
						if($val)$infowhere = "and info like '%".$val."%'";	
					}
				}
				
				if($infowhere)
				{
					$paraidi++;
					$paraidStr[$paraidi] = "";
					
					$wherelang = "";
					if($configinfo['lang'])$wherelang = "and lang = '".$configinfo['lang']."'";
					$sql = "SELECT * FROM $table_modulepara_para_list WHERE paraid = '".$key."' ".$infowhere." and classid in(".$configinfo['columnclassids'].") and module = '".$module."' $wherelang";
					$plist = $cjdb->getAll($sql);
					if(is_array($plist))
					{
						foreach($plist as $key=>$val)
						{
							$paraidStr[$paraidi] .= $val['listid'].",";
						}
					}else{
						$paraidStr[$paraidi] .= "-1,";// 当前存在一项参数搜索为空时，筛选记录设置为空
						break;	
					}
				}
			}
		}
		if(ifarray($paraidStr))
		{
			foreach($paraidStr as $key=>$val)
			{
				$val = substr($val, 0, -1);
				if($thinkphpok == 1)
				{
					$where[$prefix.$configinfo['article_id']][] = array('in',$val);
				}else{
					$where .= "AND {$prefix}".$configinfo['article_id']." in ($val)";
				}
			}
		}
	}
	
	if($type==3)
	{		
		$paraidi=0;
		$paraidStr = array();
		foreach($data as $key=>$val)
		{
			if(is_array($val))
			{
				if(ifarray($val) == 0)
				{
					$val = "";
				}
			}
			if($val)
			{
				$filter[$key] = $val;
			
				$paraidi++;
				$paraidStr[$paraidi] = "";
				
				$wherelang = "";
				if($configinfo['lang'])$wherelang = "and lang = '".$configinfo['lang']."'";
				$sql = "SELECT * FROM $table_modulepara_para_list WHERE paraid = '".$key."' AND ".$val." and classid in(".$configinfo['columnclassids'].") and module = '".$module."' $wherelang";
				$plist = $cjdb->getAll($sql);
				if(is_array($plist))
				{
					foreach($plist as $key=>$val)
					{
						$paraidStr[$paraidi] .= $val['listid'].",";
					}
				}else{
					$paraidStr[$paraidi] .= "-1,";// 当前存在一项参数搜索为空时，筛选记录设置为空
					break;
				}
			}
		}
		if(ifarray($paraidStr))
		{
			foreach($paraidStr as $key=>$val)
			{
				$val = substr($val, 0, -1);
				if($thinkphpok == 1)
				{
					$where[$prefix.$configinfo['article_id']][] = array('in',$val);
				}else{
					$where .= "AND {$prefix}".$configinfo['article_id']." in ($val)";
				}
			}
		}
	}

	return array("where"=>$where,"filter"=>$filter);
}

// 获取关联数据列表
function getattrdatalist($tablename='', $dataidname='', $bigclassname='', $classid=0, $attrid=0, $topid=0, $where="", $order="")
{
	global $cjdb,$configinfo;
	
	$wherelang = "";
	if($configinfo['lang'])$wherelang = "and lang = '".$configinfo['lang']."'";
	if($where)$where = "and ".$where;
	if($order)$order = "order by ".$order;
	$sql = "SELECT * FROM $tablename WHERE $bigclassname = '$classid' and attrid = '$attrid' $wherelang $where $order";
	$datalist = $cjdb->getAll($sql);
	
	foreach($datalist as $key=>$val)
	{
		$parainfo = getmoduleparameter($val[$dataidname], $topid);
		if($parainfo)$datalist[$key] += $parainfo;
	}
	
	return $datalist;
}

/* 获取自定义模块，自定义插件，自定义区块后台栏目菜单 */
function adminmodulemenu($tablename='',$classidname='',$bigclassname='',$classnamename='',$urlname='',$order="",$allok=0)
{
	global $cjdb,$configinfo;

	if($order)$order = "order by $order";	
	
	if(!empty($configinfo['colids']) && $allok != 1)$colwhere = "and $classidname not in($configinfo[colids])";// 配置关闭栏目模块
	$sql = "SELECT * FROM $tablename WHERE $bigclassname = '0' $colwhere $order";
	$moudlemenu = $cjdb->getAll($sql);
	foreach($moudlemenu as $key=>$val)
	{
		// 管理员权限栏目
		$useraccessok = adminprivileges($val[$classidname]);
		if($useraccessok == 1)
		{
			// 获取二级菜单
			if(!empty($configinfo['colids2']) && $allok != 1)$colwhere2 = "and $classidname not in($configinfo[colids2])";
			$sql = "SELECT * FROM $tablename WHERE $bigclassname = '$val[$classidname]' $colwhere2 $order";
			$moudlemenu2 = $cjdb->getAll($sql);
			foreach($moudlemenu2 as $key2=>$val2)
			{
				// 新增自定义分类 DATE:2020-4-19 START
				if(($val2['index_num'] == '自定义分类' || $val2['index_num'] == '自定义模型') && $allok != 1)
				{
					unset($moudlemenu2[$key2]);
				}
				// 新增自定义分类 DATE:2020-4-19 END	
			}
			
			// 获取三级菜单
			foreach($moudlemenu2 as $key2=>$val2)
			{
				if(!empty($configinfo['colids3']) && $allok != 1)$colwhere3 = "and $classidname not in($configinfo[colids3])";
				$sql = "SELECT * FROM $tablename WHERE $bigclassname = '$val2[$classidname]' $colwhere3 $order";
				$moudlemenu3 = $cjdb->getAll($sql);
				foreach($moudlemenu3 as $key3=>$val3)
				{
					// 新增自定义分类 DATE:2020-4-19 START
					if(($val3['index_num'] == '自定义分类' || $val3['index_num'] == '自定义模型') && $allok != 1)
					{
						unset($moudlemenu3[$key3]);
					}
					// 新增自定义分类 DATE:2020-4-19 END	
				}
				
				// 组合三级菜单
				$moudlemenu2[$key2]['menu3'] = $moudlemenu3;
			}
			
			// 组合二级菜单
			$moudlemenu[$key]['menu2'] = $moudlemenu2;
			
			// 自定义配置
			if($val['index_num'] == '自定义配置')
			{
				$configmoudlemenu[$key] = $moudlemenu[$key];
				unset($moudlemenu[$key]);
			}
			
			// 自定义区块
			if($val['index_num'] == '自定义区块')
			{
				$blockmoudlemenu[$key] = $moudlemenu[$key];
				unset($moudlemenu[$key]);
			}
			
			// 新增自定义分类 DATE:2020-4-19 START
			if(($val['index_num'] == '自定义分类' || $val['index_num'] == '自定义模型') && $allok != 1)
			{
				unset($moudlemenu[$key]);
			}
			// 新增自定义分类 DATE:2020-4-19 END
		}else{
			unset($moudlemenu[$key]);	
		}
	}
	
	// 重组自定义配置
	if(is_array($configmoudlemenu))
	{
		foreach($configmoudlemenu as $key=>$val)
		{
			$res[] = $val;
		}
	}
	
	// 重组自定义区块
	if(is_array($blockmoudlemenu))
	{
		foreach($blockmoudlemenu as $key=>$val)
		{
			$res[] = $val;
		}
	}
	
	// 重组其它模块
	if(is_array($moudlemenu))
	{
		foreach($moudlemenu as $key=>$val)
		{
			$res[] = $val;
		}
	}
	
	if(is_array($res))
	{
		// 重组数组	
		foreach($res as $key=> $val)
		{
			// 二级菜单为空时将一级分类创建为二级菜单
			if(empty($val['menu2']))
			{
				$res[$key]['menu2'][0][$classidname] = $val[$classidname];	
				$res[$key]['menu2'][0][$classnamename] = $val[$classnamename];	
				$res[$key]['menu2'][0]["ismenu1ok"] = 1;	
			}
			
			// 自定义配置
			if($val['index_num'] == '自定义配置' && $configinfo['adminid'] > 1)
			{
				$res[$key]['sysmodule'] = 1;
			}			
		}
	}
	
	$adminmodulemenu = $res;
	
	// 获取后台导航菜单
	$adminmodulemenu_leftnav = array();
	foreach($adminmodulemenu as $key=>$menu)
	{
		if(empty($menu['sysmodule']) && $menu['menu_show'] != 1)
		{
			$adminmodulemenu_leftnav[$key] = $menu;
			unset($adminmodulemenu_leftnav[$key]['menu2']);
			foreach($menu['menu2'] as $key2 => $menu2)
			{
				if(($menu[$classidname] != $configinfo['zdyconfig'] || in_array($menu2[$classidname],$configinfo['adminsystemmenu'])) && $menu2['menu_show'] != 1)
				{
					$adminmodulemenu_leftnav[$key]['menu2'][$key2] = $menu2;
					unset($adminmodulemenu_leftnav[$key]['menu2'][$key2]['menu3']);
					foreach($menu2['menu3'] as $key3 => $menu3)
					{
						if($menu3['menu_show'] != 1)
						{
							$adminmodulemenu_leftnav[$key]['menu2'][$key2]['menu3'][$key3] = $menu3;	
						}
					}
				}
			}
		}
	}
	
	// 获取后台权限分配栏目
	$adminmodulemenu_pricolumn = array();
	foreach($adminmodulemenu as $key=>$menu)
	{
		if($menu['colseqx'] == 0)
		{
			$adminmodulemenu_pricolumn[$key] = $menu;
			unset($adminmodulemenu_pricolumn[$key]['menu2']);
			foreach($menu['menu2'] as $key2 => $menu2)
			{
				if(($menu[$classidname] != $configinfo['zdyconfig'] || in_array($menu2[$classidname],$configinfo['adminsystempri'])) && $menu2['colseqx'] == 0)
				{
					$adminmodulemenu_pricolumn[$key]['menu2'][$key2] = $menu2;
				}
			}
		}
	}

	return array('adminmodulemenu' => $adminmodulemenu, 'leftnav' => $adminmodulemenu_leftnav, 'pricolumn' => $adminmodulemenu_pricolumn);	
}

// 后台管理员权限配置
function adminprivileges($topid=0)
{
	global $supplier_id;
	global $configinfo,$configblock;
	
	// 模块信息配置 DATE：2020-4-9 START
	$gettopid = $topid;
	$topid = $topid ? $topid : $configinfo['moduleid'];
	// 模块信息配置 DATE：2020-4-9 END
	
	// 获取管理员权限
	if($configinfo['adminok'] == 1 && $configinfo['adminid'] > 2)
	{
		$modulepri = $configblock['模块权限管理']['模块权限管理']['listattr_'.$configinfo['adminid'].'_adminpri'];
		
		// 新增后台商家用户配置访问后台模块权限
		if($supplier_id)
		{
			$modulepriids = $configinfo['expsupplier_modulepri'];
			
			// 自动获取模块子分类权限
			$allbotclass = getbottomclass($configinfo["ecs_article_cat"],$configinfo['expsupplier_modulepri'],$configinfo['cat_id'],$configinfo['parent_id'],1);
			if($allbotclass)$modulepriids .= ",".$allbotclass;
			
			// 格式化权限ID
			$modulepri = array();
			$modulepriarr = getstrtoarr(',',$modulepriids);
			foreach($modulepriarr as $key=>$pricolumnid)
			{
				$modulepri[] = "admin".$pricolumnid."pri";
			}
		}
		
	}else{
		$modulepri = 'all';		
	}
	
	// 获取多级栏目权限配置
	if(empty($gettopid))$topid = getcolumnconfigdata($configinfo['cat_id']);
	
	$useraccessok=0;
	if(in_array("admin".$topid."pri",$modulepri) || $modulepri == 'all')
	{
		$useraccessok = 1;
	}
	return $useraccessok;
}

// 通过当前语言获取下一个语言
function getdownlanginfo($langnow = "")
{
	global $configinfo;
	
	if(empty($langnow))$langnow = $configinfo['lang'];
	
	$downlang = "";
	
	if($langnow)
	{
		// 获取当前语言键值
		foreach($configinfo['langlist'] as $key=>$val)
		{
			if($val == $langnow)	
			{
				$langkeynow = $key;
			}
		}
		
		// 获取下一个语言
		if($configinfo['langlist'][$langkeynow+1])
		{
			$downlang = $configinfo['langlist'][$langkeynow+1];
		}else{
			$downlang = "lastlang";
		}
	}
	
	return $downlang;
}

// 返回下一个语言添加数据URL
function getdownlangurl($url='',$defaulturl='')
{
	global $configinfo;
	global $supplier_id;
	
	// 默认字段开启关闭配置
	$articledeffield = getdefaultarticlefield($configinfo['moduleid']);
	$otherinfoconfig = $articledeffield['otherinfoconfig'];
	
	// 获取下一个语言
	$downlang = getdownlanginfo();
	
	// 当前栏目URL
	$url = str_replace("{columnclass}",$configinfo['columninfo'][$configinfo['cat_id']],$url);
	$defaulturl = str_replace("{columnclass}",$configinfo['columninfo'][$configinfo['cat_id']],$defaulturl);
	
	// 下个语言URL
	if($downlang == "lastlang")
	{
		$newurl = str_replace("{defaultlang}",$configinfo['langdefault'],$defaulturl);
		$downlangurl = $newurl;
		
	}else{
		$newurl = str_replace("{downlang}",$downlang,$url);
		$downlangurl = $newurl;	
	}
	
	// 不跳转下一个语言模块
	if(moduleaqvarval('attrid','intval'))$attrid = moduleaqvarval('attrid','intval');
	if(moduleaqvarval('listattrid','intval'))$listattrid = moduleaqvarval('listattrid','intval');
	if(moduleaqvarval('supplierdata','intval'))$supplierdata = moduleaqvarval('supplierdata','intval');
	if(moduleaqvarval('morepara','string'))$morepara = moduleaqvarval('morepara','string');
	$zdyblockconfig = iszdyblockconfig(0,1);
	if(empty($configinfo['langok']) || $attrid || $listattrid || $supplierdata || $morepara || $supplier_id || $zdyblockconfig['zdyok'] == 1 || $otherinfoconfig['langtab'] == 0)
	{
		$downlangurl = "";	
	}
	
	return $downlangurl;	
}

/**
 * base64图片上传
 * @param $base64_img
 * @return array
 * $filedir = IA_ROOT.'/attachment/module/hsy/';
 * $uploaddir = 'module/hsy/';
 * $uploadimages = base64uploadduopic($_GPC['st_duopic'],$filedir,$uploaddir);
 */
// base64上传多张图片
function base64uploadduopic($file='',$filedir='',$uploaddir='')
{
	$base64_img_data = $file;
	$up_dir = $filedir.date("Ym")."/";//存放在当前目录的upload文件夹下
	$uploaddir = $uploaddir.date("Ym")."/";
	
	if(!file_exists($up_dir)){
		mkdir($up_dir,0777,true);
	}
	 
	$img_path = array();
	foreach($base64_img_data as $key=>$base64_img)
	{
		if(preg_match('/^(data:\s*image\/(\w+);base64,)/', $base64_img, $result)){
			$type = $result[2];
			if(in_array($type,array('pjpeg','jpeg','jpg','gif','bmp','png'))){
				$new_file = $up_dir.date('YmdHis_').$key.'.'.$type;
				if(file_put_contents($new_file, base64_decode(str_replace($result[1], '', $base64_img)))){
					$img_path[] = $uploaddir.date('YmdHis_').$key.'.'.$type;;
				}else{
					alertback('图片上传失败');
		 
				}
			}else{
				//文件类型错误
				alertback('图片上传类型错误');
			}
		 
		}else{
			//文件错误
			alertback('文件错误');
		}
	}	
	
	return $img_path;
}

// 当前模块是否是自定义区块或自定义配置
function iszdyblockconfig($topid=0,$type=0,$moduletopid=0)
{
	global $configinfo;
	
	// 模块信息配置 DATE：2020-4-9 START
	$topid = $topid ? $topid : $configinfo['moduleid'];
	$moduletopid = $moduletopid ? $moduletopid : $configinfo['moduletopid'];
	if(empty($moduletopid))$moduletopid = gettopclass($configinfo["ecs_article_cat"], $topid, $configinfo["cat_id"], $configinfo["parent_id"], 1);	
	// 模块信息配置 DATE：2020-4-9 END
	
	$zdyarr = explode(",", $configinfo['zdyid']);	
	$zdydelarr = explode(",", $configinfo['zdydelok']);	
	
	// 新增模块多级栏目参数配置 DATE:2020-4-28 START
	$topid = gettopid($topid);
	// 新增模块多级栏目参数配置 DATE:2020-4-28 END
	
	// 是否是自定义区块配置
	if(in_array($moduletopid,$zdyarr))
	{
		$zdytype = $moduletopid == $configinfo['zdyconfig'] ? "config" : "block";
		
		// 允许删除的自定义区块数据
		if(in_array($topid,$zdydelarr))
		{
			return $type == 1 ? array('type'=>2,'zdyok'=>1,'zdytype'=>$zdytype) : 2;
		}else{
			return $type == 1 ? array('type'=>1,'zdyok'=>1,'zdytype'=>$zdytype) : 1;
		}
	}else{
		return $type == 1 ? array('type'=>2,'zdyok'=>0,'zdytype'=>'other') : 2;
	}
		
}

// 默认表字段命名转换
function getdesignatedname($defname='')
{
	$designatedname = $defname;
	
	return $designatedname;
}

/***************************
&& PHP自定义字符串中的变量名解析
&& 作用：用于后台添加内容代码时获取变量使用
^^ 使用于：后台【内容管理-简介模块-内容代码】
(( 使用范围：变量，一维数组，二维数组
** 作者：白屋之恋萧
** DATE：2014-11-4
** QQ：1159230549
** TEL:15057925329
** 主页：http://www.15cy.cn/
$match = array();preg_match_all('/{\$(.*?)}/', $contenthtml, $match);foreach($match[1] as $key => $value) {
if(isset($$value)) {$contenthtml = str_replace($match[0][$key], $$value, $contenthtml);}}
***************************/
function phpvarok($contenthtml, $phpvarok, $phpvarok1="", $phpvarok2="", $phpvarok3="")
{
	global $lang;
	global $_MGPC_POST,$_MGPC_GET,$_MGPC_REQ,$_MGPC_COOKIE,$_MGPC_SESSION,$configlang,$configinfo,$configblock,$configcommon,$configmember,$configbase,$configsystem,$configindex,$configother;

	if($phpvarok == "modulepara")
	{
		global $parameter_out,$getmoduleconfig;
		$get = $GLOBALS['_MGPC_GET'];$post = $GLOBALS['_MGPC_POST'];
		global $parameter;
		global $parameter_list;
		global $parameter_json;
		global $parameter_default;
		global $parameter_exp;
		global $parameter_expplist;
		global $parameter_exptable;
		global $parameter_attr;
		global $parameter_other;
	}
		
	if($contenthtml)
	{
		$match = array();
		preg_match_all('/\(\$(.*?)\)/', $contenthtml, $match);// 匹配成功后的$match[0]为原格式{$parameter_default[field1]} $match[1]为匹配的内容格式parameter_default[field1]
		
		if(count($match))
		{
			foreach($match[1] as $key => $value)
			{
				preg_match_all('/\[(.*?)\]/', $value, $match2);// $match2[0][0]格式为[field1] $match2[1][0]格式为field1
				/*print_r($match2);
				Array
				(
					[0] => Array
						(
							[0] => [field1] // 解析模板中的一维数组{$parameter_default[field1]}
							[1] => [二维数组名] // 解析模板中的二维数组{$parameter_default[field1][二维数组名]}
						)
				
					[1] => Array
						(
							[0] => field1 // 解析模板中的一维数组{$parameter_default[field1]}
							[1] => [二维数组名] // 解析模板中的二维数组{$parameter_default[field1][二维数组名]}
						)
				
				)*/
				// 获取数组前缀class_list删除[$class1]
				if(isset($match2[1][0]))
				{
					$value = str_replace($match2[0][0], '', $value);// class_list[url]
				}
				
				// 获取数组前缀class_list删除[url]
				if(isset($match2[1][1]))
				{
					$value = str_replace($match2[0][1], '', $value);// class_list
				}
				
				// 组合数组$class_list
				$value=$$value;// $ => $ | $value => class_list
				
				if(!empty($value))
				{
					// 获取解析后的一维数组名$class1 $class_list[解析此变量]
					if(isset($match2[1][0]))
					{
						$valuekey1=$match2[1][0];// $class1
						
						// 将数组名$class1替换为class1【解析字符串$class1】
						preg_match_all('/\$(.+)/', $valuekey1, $match3);// $match3[0][0]格式为$class1 $match3[1][0]格式为class1
						@$valuekey1r=$match3[1][0];// class1
						if($valuekey1r)$valuekey1=$$valuekey1r;// $ => $ | $valuekey1r => class1
						
						// 组合数组$class_list[$class1]
						@$valuer=$value[$valuekey1];
						
						// 获取解析后的二维数组名url $class_list[$class1][解析此变量]
						if(isset($match2[1][1]))
						{
							$valuekey2=$match2[1][1];// $url
							
							// 将数组名url替换为url【解析字符串url】
							preg_match_all('/\$(.+)/', $valuekey2, $match4);
							@$valuekey2r=$match4[1][1];// url
							if($valuekey2r)$valuekey2=$$valuekey2r;// $ => $ | $valuekey2r => url
		
							// 组合数组$class_list[$class1][url]
							@$valuer=$value[$valuekey1][$valuekey2];
						}
						
						// 获取组合成功数组
						$value=$valuer;
					}		
				}
				
				// 【替换原有字段串，重要赋值】输出结果数组内容
				$valuedata = !empty($value) ? $value : '';// 修复空数组时输出Array
				$contenthtml = str_replace($match[0][$key], $value, $contenthtml);// $match[0][$key] => {$parameter_default[field1]}
			}
		}
	}
	
	return $contenthtml;
}
?>